mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Tie SerializedTransacion code to NewcoinAddress code.
This commit is contained in:
@@ -38,14 +38,14 @@ SerializedTransaction::SerializedTransaction(SerializerIterator& sit, int length
|
|||||||
mMiddleTxn.giveObject(new STUInt64("Fee", sit.get64()));
|
mMiddleTxn.giveObject(new STUInt64("Fee", sit.get64()));
|
||||||
|
|
||||||
mInnerTxn = STObject(mFormat->elements, sit, "InnerTransaction");
|
mInnerTxn = STObject(mFormat->elements, sit, "InnerTransaction");
|
||||||
updateSigningAccount();
|
updateSourceAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerializedTransaction::updateSigningAccount()
|
void SerializedTransaction::updateSourceAccount()
|
||||||
{
|
{
|
||||||
NewcoinAddress a;
|
NewcoinAddress a;
|
||||||
a.setAccountPublic(peekRawSigningAccount());
|
a.setAccountPublic(peekRawSigningAccount());
|
||||||
mSigningAccount = a.getAccountID();
|
mSourceAccount.setAccountID(a.getAccountID());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SerializedTransaction::getLength() const
|
int SerializedTransaction::getLength() const
|
||||||
@@ -207,7 +207,7 @@ void SerializedTransaction::setSigningAccount(const std::vector<unsigned char>&
|
|||||||
STVariableLength* v = dynamic_cast<STVariableLength*>(mMiddleTxn.getPIndex(TransactionISigningAccount));
|
STVariableLength* v = dynamic_cast<STVariableLength*>(mMiddleTxn.getPIndex(TransactionISigningAccount));
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
if (!v) throw std::runtime_error("corrupt transaction");
|
||||||
v->setValue(s);
|
v->setValue(s);
|
||||||
updateSigningAccount();
|
updateSourceAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint160 SerializedTransaction::getITFieldAccount(SOE_Field field) const
|
uint160 SerializedTransaction::getITFieldAccount(SOE_Field field) const
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "SerializedObject.h"
|
#include "SerializedObject.h"
|
||||||
#include "TransactionFormats.h"
|
#include "TransactionFormats.h"
|
||||||
|
#include "NewcoinAddress.h"
|
||||||
|
|
||||||
class SerializedTransaction : public STObject
|
class SerializedTransaction : public STObject
|
||||||
{
|
{
|
||||||
@@ -15,13 +16,13 @@ public:
|
|||||||
typedef boost::shared_ptr<SerializedTransaction> pointer;
|
typedef boost::shared_ptr<SerializedTransaction> pointer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint160 mSigningAccount;
|
NewcoinAddress mSourceAccount;
|
||||||
TransactionType mType;
|
TransactionType mType;
|
||||||
STVariableLength mSignature;
|
STVariableLength mSignature;
|
||||||
STObject mMiddleTxn, mInnerTxn;
|
STObject mMiddleTxn, mInnerTxn;
|
||||||
TransactionFormat* mFormat;
|
TransactionFormat* mFormat;
|
||||||
|
|
||||||
void updateSigningAccount();
|
void updateSourceAccount();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerializedTransaction(SerializerIterator& sit, int length); // -1=all remaining, 0=get from sit
|
SerializedTransaction(SerializerIterator& sit, int length); // -1=all remaining, 0=get from sit
|
||||||
@@ -45,10 +46,12 @@ public:
|
|||||||
// middle transaction functions
|
// middle transaction functions
|
||||||
uint32 getVersion() const;
|
uint32 getVersion() const;
|
||||||
void setVersion(uint32);
|
void setVersion(uint32);
|
||||||
|
|
||||||
TransactionType getTxnType() const { return mType; }
|
TransactionType getTxnType() const { return mType; }
|
||||||
uint64 getTransactionFee() const;
|
uint64 getTransactionFee() const;
|
||||||
void setTransactionFee(uint64);
|
void setTransactionFee(uint64);
|
||||||
uint160 getSigningAccount() const { return mSigningAccount; }
|
|
||||||
|
const NewcoinAddress& getSourceAccount() const { return mSourceAccount; }
|
||||||
std::vector<unsigned char> getRawSigningAccount() const;
|
std::vector<unsigned char> getRawSigningAccount() const;
|
||||||
const std::vector<unsigned char>& peekRawSigningAccount() const;
|
const std::vector<unsigned char>& peekRawSigningAccount() const;
|
||||||
std::vector<unsigned char>& peekRawSigningAccount();
|
std::vector<unsigned char>& peekRawSigningAccount();
|
||||||
@@ -90,6 +93,10 @@ public:
|
|||||||
{ return mInnerTxn.setValueFieldVL(field, v); }
|
{ return mInnerTxn.setValueFieldVL(field, v); }
|
||||||
void setITFieldTL(SOE_Field field, const std::vector<TaggedListItem>& v)
|
void setITFieldTL(SOE_Field field, const std::vector<TaggedListItem>& v)
|
||||||
{ return mInnerTxn.setValueFieldTL(field, v); }
|
{ return mInnerTxn.setValueFieldTL(field, v); }
|
||||||
|
void setITFieldAccount(SOE_Field field, const uint160& v)
|
||||||
|
{ return mInnerTxn.setValueFieldAccount(field, v); }
|
||||||
|
void setITFieldAccount(SOE_Field field, const NewcoinAddress& v)
|
||||||
|
{ return mInnerTxn.setValueFieldAccount(field, v); }
|
||||||
|
|
||||||
// optional field functions
|
// optional field functions
|
||||||
bool getITFieldPresent(SOE_Field field) const;
|
bool getITFieldPresent(SOE_Field field) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user