Temporary fix to some issues caused by transaction flattening.

Will work out details with Arthur.
This commit is contained in:
JoelKatz
2012-09-30 22:42:06 -07:00
parent 11d092b98e
commit 5cc421bc76
5 changed files with 18 additions and 12 deletions

View File

@@ -99,13 +99,14 @@
FIELD(PublicKey, VL, 1)
FIELD(MessageKey, VL, 2)
FIELD(SigningPubKey, VL, 3)
FIELD(Signature, VL, 4)
FIELD(TxnSignature, VL, 4)
FIELD(Generator, VL, 5)
FIELD(Domain, VL, 6)
FIELD(FundCode, VL, 7)
FIELD(RemoveCode, VL, 8)
FIELD(ExpireCode, VL, 9)
FIELD(CreateCode, VL, 10)
FIELD(Signature, VL, 6)
FIELD(Domain, VL, 7)
FIELD(FundCode, VL, 8)
FIELD(RemoveCode, VL, 9)
FIELD(ExpireCode, VL, 10)
FIELD(CreateCode, VL, 11)
// account
FIELD(Account, ACCOUNT, 1)
@@ -129,4 +130,5 @@
// array of objects
// ARRAY/1 is reserved for end of array
FIELD(SigningAccounts, ARRAY, 2)
FIELD(Signatures, ARRAY, 3)
FIELD(TxnSignatures, ARRAY, 3)
FIELD(Signatures, ARRAY, 4)

View File

@@ -30,7 +30,11 @@ SerializedLedgerEntry::SerializedLedgerEntry(const Serializer& s, const uint256&
throw std::runtime_error("invalid ledger entry type");
mType = mFormat->t_type;
if (!setType(mFormat->elements))
{
Log(lsWARNING) << "Ledger entry not valid for type " << mFormat->t_name;
Log(lsWARNING) << getJson(0);
throw std::runtime_error("ledger entry not valid for type");
}
}
SerializedLedgerEntry::SerializedLedgerEntry(LedgerEntryType type) : STObject(sfLedgerEntry), mType(type)

View File

@@ -250,7 +250,7 @@ void STObject::add(Serializer& s, bool withSigningFields) const
if (it.getSType() != STI_NOTPRESENT)
{
SField::ref fName = it.getFName();
if (withSigningFields || ((fName != sfSignature) && (fName != sfSignatures)))
if (withSigningFields || ((fName != sfTxnSignature) && (fName != sfTxnSignatures)))
fields.insert(std::make_pair(it.getFName().fieldCode, &it));
}
}

View File

@@ -94,7 +94,7 @@ std::vector<unsigned char> SerializedTransaction::getSignature() const
{
try
{
return getValueFieldVL(sfSignature);
return getValueFieldVL(sfTxnSignature);
}
catch (...)
{
@@ -106,14 +106,14 @@ void SerializedTransaction::sign(const NewcoinAddress& naAccountPrivate)
{
std::vector<unsigned char> signature;
naAccountPrivate.accountPrivateSign(getSigningHash(), signature);
setValueFieldVL(sfSignature, signature);
setValueFieldVL(sfTxnSignature, signature);
}
bool SerializedTransaction::checkSign(const NewcoinAddress& naAccountPublic) const
{
try
{
return naAccountPublic.accountPublicVerify(getSigningHash(), getValueFieldVL(sfSignature));
return naAccountPublic.accountPublicVerify(getSigningHash(), getValueFieldVL(sfTxnSignature));
}
catch (...)
{

View File

@@ -39,7 +39,7 @@ public:
// outer transaction functions / signature functions
std::vector<unsigned char> getSignature() const;
void setSignature(const std::vector<unsigned char>& s) { setValueFieldVL(sfSignature, s); }
void setSignature(const std::vector<unsigned char>& s) { setValueFieldVL(sfTxnSignature, s); }
uint256 getSigningHash() const;
TransactionType getTxnType() const { return mType; }