Exemplo n.º 1
0
    void EtherIPC::handleUnlockAccount() {
        QJsonValue jv;
        if ( !readReply(jv) ) {
            return bail();
        }

        const bool result = jv.toBool(false);

        if ( !result ) {
            setError("Unlock account failure");
            if ( parseVersionNum() == 100002 ) {
                fError += " Geth v1.0.2 has a bug with unlocking empty password accounts! Consider updating";
            }
            emit error();
        }
        emit unlockAccountDone(result, fActiveRequest.getIndex());
        done();
    }
Exemplo n.º 2
0
    void EtherIPC::handleGetAccounts() {
        QJsonValue jv;
        if ( !readReply(jv) ) {
            return bail();
        }

        QJsonArray refs = jv.toArray();
        foreach( QJsonValue r, refs ) {
            const QString hash = r.toString("INVALID");
            fAccountList.append(AccountInfo(hash, QString(), 0));
        }

        emit getAccountsDone(fAccountList);

        // TODO: figure out a way to get account transaction history
        newFilter();

        done();
    }
Exemplo n.º 3
0
    void EtherIPC::handleGetFilterChanges() {
        QJsonValue jv;
        if ( !readReply(jv) ) {
            return bail();
        }

        QJsonArray ar = jv.toArray();

        foreach( const QJsonValue v, ar ) {
            if ( v.isObject() ) { // event filter result
                const QJsonObject logs = v.toObject();
                emit newEvent(logs, fActiveRequest.getType() == GetFilterChanges); // get logs is not "new"
            } else { // block filter (we don't use transaction filters yet)
                const QString hash = v.toString("bogus");
                getBlockByHash(hash);
            }
        }

        done();
    }
Exemplo n.º 4
0
    void EtherIPC::handleGetClientVersion() {
        QJsonValue jv;
        if ( !readReply(jv) ) {
            return bail();
        }

        fClientVersion = jv.toString();

        const int vn = parseVersionNum();
        if ( vn > 0 && vn < 100002 ) {
            setError("Geth version 1.0.1 and older contain a critical bug! Please update immediately.");
            emit error();
        }

        if ( vn > 0 && vn < 103005 ) {
            setError("Geth version 1.3.4 and older are Frontier versions. Please update to Homestead (1.3.5+)");
            emit error();
        }

        emit clientVersionChanged(fClientVersion);
        done();
    }