mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Revise doClaim for proof.
This commit is contained in:
@@ -254,7 +254,26 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
|||||||
return tenCLAIMED;
|
return tenCLAIMED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint160 hGeneratorID = txn.getITFieldH160(sfGeneratorID);
|
//
|
||||||
|
// Verify claim is authorized
|
||||||
|
//
|
||||||
|
|
||||||
|
std::vector<unsigned char> vucCipher = txn.getITFieldVL(sfGenerator);
|
||||||
|
std::vector<unsigned char> vucPubKey = txn.getITFieldVL(sfPubKey);
|
||||||
|
std::vector<unsigned char> vucSignature = txn.getITFieldVL(sfSignature);
|
||||||
|
|
||||||
|
NewcoinAddress naAccountPublic;
|
||||||
|
|
||||||
|
naAccountPublic.setAccountPublic(vucPubKey);
|
||||||
|
|
||||||
|
if (!naAccountPublic.accountPublicVerify(Serializer::getSHA512Half(vucCipher), vucSignature))
|
||||||
|
{
|
||||||
|
std::cerr << "doClaim: bad signature unauthorized claim" << std::endl;
|
||||||
|
return tenINVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint160 hGeneratorID = naAccountPublic.getAccountID();
|
||||||
|
|
||||||
qry = lepNONE;
|
qry = lepNONE;
|
||||||
SerializedLedgerEntry::pointer gen = mLedger->getGenerator(qry, hGeneratorID);
|
SerializedLedgerEntry::pointer gen = mLedger->getGenerator(qry, hGeneratorID);
|
||||||
if (gen)
|
if (gen)
|
||||||
@@ -267,7 +286,6 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
|
|||||||
//
|
//
|
||||||
// Claim the account.
|
// Claim the account.
|
||||||
//
|
//
|
||||||
std::vector<unsigned char> vucCipher = txn.getITFieldVL(sfGenerator);
|
|
||||||
|
|
||||||
// Set the public key needed to use the account.
|
// Set the public key needed to use the account.
|
||||||
dest->setIFieldH160(sfAuthorizedKey, hGeneratorID);
|
dest->setIFieldH160(sfAuthorizedKey, hGeneratorID);
|
||||||
|
|||||||
Reference in New Issue
Block a user