Return temINVALID_FLAG for transaction with no flags.

This commit is contained in:
Arthur Britto
2013-01-03 14:07:41 -08:00
parent 7c0b43fe06
commit 7dfbe2aea1
7 changed files with 123 additions and 73 deletions

View File

@@ -1,5 +1,7 @@
#include "WalletAddTransactor.h"
SETUP_LOG();
TER WalletAddTransactor::doApply()
{
std::cerr << "WalletAdd>" << std::endl;
@@ -7,9 +9,18 @@ TER WalletAddTransactor::doApply()
const std::vector<unsigned char> vucPubKey = mTxn.getFieldVL(sfPublicKey);
const std::vector<unsigned char> vucSignature = mTxn.getFieldVL(sfSignature);
const uint160 uAuthKeyID = mTxn.getFieldAccount160(sfRegularKey);
const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey);
const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey);
const uint160 uDstAccountID = naMasterPubKey.getAccountID();
const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "WalletAdd: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
// FIXME: This should be moved to the transaction's signature check logic and cached
if (!naMasterPubKey.accountPublicVerify(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature))
{