mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Rewrite a lot of the SerializedTransaction code. Mostly just removing obsolete code.
This commit is contained in:
@@ -7,21 +7,16 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "HashPrefixes.h"
|
#include "HashPrefixes.h"
|
||||||
|
|
||||||
SerializedTransaction::SerializedTransaction(TransactionType type) : mType(type)
|
SerializedTransaction::SerializedTransaction(TransactionType type) : STObject(sfTransaction), mType(type)
|
||||||
{
|
{
|
||||||
mFormat = getTxnFormat(type);
|
mFormat = getTxnFormat(type);
|
||||||
if (mFormat == NULL) throw std::runtime_error("invalid transaction type");
|
if (mFormat == NULL)
|
||||||
|
throw std::runtime_error("invalid transaction type");
|
||||||
mMiddleTxn.giveObject(new STVariableLength(sfSigningPubKey));
|
set(mFormat->elements);
|
||||||
mMiddleTxn.giveObject(new STAccount(sfAccount));
|
setValueFieldU16(sfTransactionType, mFormat->t_type);
|
||||||
mMiddleTxn.giveObject(new STUInt32(sfSequence));
|
|
||||||
mMiddleTxn.giveObject(new STUInt16(sfTransactionType, static_cast<uint16>(type)));
|
|
||||||
mMiddleTxn.giveObject(new STAmount(sfFee));
|
|
||||||
|
|
||||||
mInnerTxn = STObject(mFormat->elements, sfInnerTransaction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializedTransaction::SerializedTransaction(SerializerIterator& sit)
|
SerializedTransaction::SerializedTransaction(SerializerIterator& sit) : STObject(sfTransaction)
|
||||||
{
|
{
|
||||||
int length = sit.getBytesLeft();
|
int length = sit.getBytesLeft();
|
||||||
if ((length < TransactionMinLen) || (length > TransactionMaxLen))
|
if ((length < TransactionMinLen) || (length > TransactionMaxLen))
|
||||||
@@ -30,27 +25,18 @@ SerializedTransaction::SerializedTransaction(SerializerIterator& sit)
|
|||||||
throw std::runtime_error("Transaction length invalid");
|
throw std::runtime_error("Transaction length invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
mSignature.setValue(sit.getVL());
|
set(sit);
|
||||||
|
mType = static_cast<TransactionType>(getValueFieldU16(sfTransactionType));
|
||||||
|
|
||||||
mMiddleTxn.giveObject(new STVariableLength(sfSigningPubKey, sit.getVL()));
|
|
||||||
|
|
||||||
STAccount sa(sfAccount, sit.getVL());
|
|
||||||
mSourceAccount = sa.getValueNCA();
|
|
||||||
mMiddleTxn.giveObject(new STAccount(sa));
|
|
||||||
|
|
||||||
mMiddleTxn.giveObject(new STUInt32(sfSequence, sit.get32()));
|
|
||||||
|
|
||||||
mType = static_cast<TransactionType>(sit.get16());
|
|
||||||
mMiddleTxn.giveObject(new STUInt16(sfTransactionType, static_cast<uint16>(mType)));
|
|
||||||
mFormat = getTxnFormat(mType);
|
mFormat = getTxnFormat(mType);
|
||||||
if (!mFormat)
|
if (!mFormat)
|
||||||
|
throw std::runtime_error("invalid transction type");
|
||||||
|
setType(mFormat->elements);
|
||||||
|
if (!isValidForType())
|
||||||
{
|
{
|
||||||
Log(lsERROR) << "Transaction has invalid type";
|
Log(lsDEBUG) << "Transaction not valid for type " << getJson(0);
|
||||||
throw std::runtime_error("Transaction has invalid type");
|
throw std::runtime_error("transaction not valid");
|
||||||
}
|
}
|
||||||
mMiddleTxn.giveObject(STAmount::deserialize(sit, sfFee));
|
|
||||||
|
|
||||||
mInnerTxn = STObject(mFormat->elements, sit, sfInnerTransaction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SerializedTransaction::getFullText() const
|
std::string SerializedTransaction::getFullText() const
|
||||||
@@ -58,29 +44,21 @@ std::string SerializedTransaction::getFullText() const
|
|||||||
std::string ret = "\"";
|
std::string ret = "\"";
|
||||||
ret += getTransactionID().GetHex();
|
ret += getTransactionID().GetHex();
|
||||||
ret += "\" = {";
|
ret += "\" = {";
|
||||||
ret += mSignature.getFullText();
|
ret += STObject::getFullText();
|
||||||
ret += mMiddleTxn.getFullText();
|
|
||||||
ret += mInnerTxn.getFullText();
|
|
||||||
ret += "}";
|
ret += "}";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SerializedTransaction::getText() const
|
std::string SerializedTransaction::getText() const
|
||||||
{
|
{
|
||||||
std::string ret = "{";
|
return STObject::getText();
|
||||||
ret += mSignature.getText();
|
|
||||||
ret += mMiddleTxn.getText();
|
|
||||||
ret += mInnerTxn.getText();
|
|
||||||
ret += "}";
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
|
std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
|
||||||
{
|
{
|
||||||
std::vector<NewcoinAddress> accounts;
|
std::vector<NewcoinAddress> accounts;
|
||||||
accounts.push_back(mSourceAccount);
|
|
||||||
|
|
||||||
BOOST_FOREACH(const SerializedType& it, mInnerTxn.peekData())
|
BOOST_FOREACH(const SerializedType& it, peekData())
|
||||||
{
|
{
|
||||||
const STAccount* sa = dynamic_cast<const STAccount*>(&it);
|
const STAccount* sa = dynamic_cast<const STAccount*>(&it);
|
||||||
if (sa != NULL)
|
if (sa != NULL)
|
||||||
@@ -103,197 +81,70 @@ std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
|
|||||||
return accounts;
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerializedTransaction::add(Serializer& s) const
|
|
||||||
{
|
|
||||||
mSignature.add(s);
|
|
||||||
mMiddleTxn.add(s);
|
|
||||||
mInnerTxn.add(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SerializedTransaction::isEquivalent(const SerializedType& t) const
|
|
||||||
{ // Signatures are not compared
|
|
||||||
const SerializedTransaction* v = dynamic_cast<const SerializedTransaction*>(&t);
|
|
||||||
if (!v) return false;
|
|
||||||
if (mType != v->mType) return false;
|
|
||||||
if (mMiddleTxn != v->mMiddleTxn) return false;
|
|
||||||
if (mInnerTxn != v->mInnerTxn) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256 SerializedTransaction::getSigningHash() const
|
uint256 SerializedTransaction::getSigningHash() const
|
||||||
{
|
{
|
||||||
Serializer s;
|
return STObject::getSigningHash(sHP_TransactionSign);
|
||||||
s.add32(sHP_TransactionSign);
|
|
||||||
mMiddleTxn.add(s);
|
|
||||||
mInnerTxn.add(s);
|
|
||||||
return s.getSHA512Half();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 SerializedTransaction::getTransactionID() const
|
uint256 SerializedTransaction::getTransactionID() const
|
||||||
{ // perhaps we should cache this
|
{ // perhaps we should cache this
|
||||||
Serializer s;
|
return getHash(sHP_TransactionID);
|
||||||
s.add32(sHP_TransactionID);
|
|
||||||
mSignature.add(s);
|
|
||||||
mMiddleTxn.add(s);
|
|
||||||
mInnerTxn.add(s);
|
|
||||||
return s.getSHA512Half();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<unsigned char> SerializedTransaction::getSignature() const
|
std::vector<unsigned char> SerializedTransaction::getSignature() const
|
||||||
{
|
{
|
||||||
return mSignature.getValue();
|
try
|
||||||
|
{
|
||||||
|
return getValueFieldVL(sfSignature);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return std::vector<unsigned char>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned char>& SerializedTransaction::peekSignature() const
|
void SerializedTransaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||||
{
|
{
|
||||||
return mSignature.peekValue();
|
std::vector<unsigned char> signature;
|
||||||
}
|
naAccountPrivate.accountPrivateSign(getSigningHash(), signature);
|
||||||
|
setValueFieldVL(sfSignature, signature);
|
||||||
bool SerializedTransaction::sign(const NewcoinAddress& naAccountPrivate)
|
|
||||||
{
|
|
||||||
return naAccountPrivate.accountPrivateSign(getSigningHash(), mSignature.peekValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerializedTransaction::checkSign(const NewcoinAddress& naAccountPublic) const
|
bool SerializedTransaction::checkSign(const NewcoinAddress& naAccountPublic) const
|
||||||
{
|
{
|
||||||
return naAccountPublic.accountPublicVerify(getSigningHash(), mSignature.getValue());
|
try
|
||||||
|
{
|
||||||
|
return naAccountPublic.accountPublicVerify(getSigningHash(), getValueFieldVL(sfSignature));
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerializedTransaction::setSignature(const std::vector<unsigned char>& sig)
|
void SerializedTransaction::setSigningPubKey(const NewcoinAddress& naSignPubKey)
|
||||||
{
|
{
|
||||||
mSignature.setValue(sig);
|
setValueFieldVL(sfSigningPubKey, naSignPubKey.getAccountPublic());
|
||||||
}
|
}
|
||||||
|
|
||||||
STAmount SerializedTransaction::getTransactionFee() const
|
void SerializedTransaction::setSourceAccount(const NewcoinAddress& naSource)
|
||||||
{
|
{
|
||||||
const STAmount* v = dynamic_cast<const STAmount*>(mMiddleTxn.peekAtPIndex(TransactionIFee));
|
setValueFieldAccount(sfAccount, naSource);
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
return *v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerializedTransaction::setTransactionFee(const STAmount& fee)
|
|
||||||
{
|
|
||||||
STAmount* v = dynamic_cast<STAmount*>(mMiddleTxn.getPIndex(TransactionIFee));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
v->setValue(fee);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 SerializedTransaction::getSequence() const
|
|
||||||
{
|
|
||||||
const STUInt32* v = dynamic_cast<const STUInt32*>(mMiddleTxn.peekAtPIndex(TransactionISequence));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
return v->getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerializedTransaction::setSequence(uint32 seq)
|
|
||||||
{
|
|
||||||
STUInt32* v = dynamic_cast<STUInt32*>(mMiddleTxn.getPIndex(TransactionISequence));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
v->setValue(seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<unsigned char> SerializedTransaction::getSigningPubKey() const
|
|
||||||
{
|
|
||||||
const STVariableLength* v =
|
|
||||||
dynamic_cast<const STVariableLength*>(mMiddleTxn.peekAtPIndex(TransactionISigningPubKey));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
return v->getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<unsigned char>& SerializedTransaction::peekSigningPubKey() const
|
|
||||||
{
|
|
||||||
const STVariableLength* v=
|
|
||||||
dynamic_cast<const STVariableLength*>(mMiddleTxn.peekAtPIndex(TransactionISigningPubKey));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
return v->peekValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<unsigned char>& SerializedTransaction::peekSigningPubKey()
|
|
||||||
{
|
|
||||||
STVariableLength* v = dynamic_cast<STVariableLength*>(mMiddleTxn.getPIndex(TransactionISigningPubKey));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
return v->peekValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
const NewcoinAddress& SerializedTransaction::setSigningPubKey(const NewcoinAddress& naSignPubKey)
|
|
||||||
{
|
|
||||||
mSignPubKey = naSignPubKey;
|
|
||||||
|
|
||||||
STVariableLength* v = dynamic_cast<STVariableLength*>(mMiddleTxn.getPIndex(TransactionISigningPubKey));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
v->setValue(mSignPubKey.getAccountPublic());
|
|
||||||
|
|
||||||
return mSignPubKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NewcoinAddress& SerializedTransaction::setSourceAccount(const NewcoinAddress& naSource)
|
|
||||||
{
|
|
||||||
mSourceAccount = naSource;
|
|
||||||
|
|
||||||
STAccount* v = dynamic_cast<STAccount*>(mMiddleTxn.getPIndex(TransactionISourceID));
|
|
||||||
if (!v) throw std::runtime_error("corrupt transaction");
|
|
||||||
v->setValueNCA(mSourceAccount);
|
|
||||||
return mSourceAccount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint160 SerializedTransaction::getITFieldAccount(SField::ref field) const
|
uint160 SerializedTransaction::getITFieldAccount(SField::ref field) const
|
||||||
{
|
{
|
||||||
uint160 r;
|
uint160 r;
|
||||||
const SerializedType* st = mInnerTxn.peekAtPField(field);
|
const STAccount* ac = dynamic_cast<const STAccount*>(peekAtPField(field));
|
||||||
if (!st) return r;
|
if (ac)
|
||||||
|
ac->getValueH160(r);
|
||||||
const STAccount* ac = dynamic_cast<const STAccount*>(st);
|
|
||||||
if (!ac) return r;
|
|
||||||
ac->getValueH160(r);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SerializedTransaction::getITFieldIndex(SField::ref field) const
|
|
||||||
{
|
|
||||||
return mInnerTxn.getFieldIndex(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SerializedTransaction::getITFieldCount() const
|
|
||||||
{
|
|
||||||
return mInnerTxn.getCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SerializedTransaction::getITFieldPresent(SField::ref field) const
|
|
||||||
{
|
|
||||||
return mInnerTxn.isFieldPresent(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
const SerializedType& SerializedTransaction::peekITField(SField::ref field) const
|
|
||||||
{
|
|
||||||
return mInnerTxn.peekAtField(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializedType& SerializedTransaction::getITField(SField::ref field)
|
|
||||||
{
|
|
||||||
return mInnerTxn.getField(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerializedTransaction::makeITFieldPresent(SField::ref field)
|
|
||||||
{
|
|
||||||
mInnerTxn.makeFieldPresent(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerializedTransaction::makeITFieldAbsent(SField::ref field)
|
|
||||||
{
|
|
||||||
return mInnerTxn.makeFieldAbsent(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::Value SerializedTransaction::getJson(int options) const
|
Json::Value SerializedTransaction::getJson(int options) const
|
||||||
{
|
{
|
||||||
Json::Value ret = Json::objectValue;
|
Json::Value ret = STObject::getJson(0);
|
||||||
ret["id"] = getTransactionID().GetHex();
|
ret["id"] = getTransactionID().GetHex();
|
||||||
ret["signature"] = mSignature.getText();
|
|
||||||
|
|
||||||
Json::Value middle = mMiddleTxn.getJson(options);
|
|
||||||
middle["type"] = mFormat->t_name;
|
|
||||||
ret["middle"] = middle;
|
|
||||||
|
|
||||||
ret["inner"] = mInnerTxn.getJson(options);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
#define TXN_SQL_INCLUDED 'I'
|
#define TXN_SQL_INCLUDED 'I'
|
||||||
#define TXN_SQL_UNKNOWN 'U'
|
#define TXN_SQL_UNKNOWN 'U'
|
||||||
|
|
||||||
class SerializedTransaction : public SerializedType
|
class SerializedTransaction : public STObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<SerializedTransaction> pointer;
|
typedef boost::shared_ptr<SerializedTransaction> pointer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NewcoinAddress mSignPubKey;
|
|
||||||
NewcoinAddress mSourceAccount;
|
|
||||||
TransactionType mType;
|
TransactionType mType;
|
||||||
STVariableLength mSignature;
|
|
||||||
STObject mMiddleTxn, mInnerTxn;
|
|
||||||
const TransactionFormat* mFormat;
|
const TransactionFormat* mFormat;
|
||||||
|
|
||||||
SerializedTransaction* duplicate() const { return new SerializedTransaction(*this); }
|
SerializedTransaction* duplicate() const { return new SerializedTransaction(*this); }
|
||||||
@@ -40,80 +36,69 @@ public:
|
|||||||
SerializedTypeID getSType() const { return STI_TRANSACTION; }
|
SerializedTypeID getSType() const { return STI_TRANSACTION; }
|
||||||
std::string getFullText() const;
|
std::string getFullText() const;
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
void add(Serializer& s) const;
|
|
||||||
virtual bool isEquivalent(const SerializedType& t) const;
|
|
||||||
|
|
||||||
// outer transaction functions / signature functions
|
// outer transaction functions / signature functions
|
||||||
std::vector<unsigned char> getSignature() const;
|
std::vector<unsigned char> getSignature() const;
|
||||||
const std::vector<unsigned char>& peekSignature() const;
|
void setSignature(const std::vector<unsigned char>& s) { setValueFieldVL(sfSignature, s); }
|
||||||
void setSignature(const std::vector<unsigned char>& s);
|
|
||||||
uint256 getSigningHash() const;
|
uint256 getSigningHash() const;
|
||||||
|
|
||||||
TransactionType getTxnType() const { return mType; }
|
TransactionType getTxnType() const { return mType; }
|
||||||
STAmount getTransactionFee() const;
|
STAmount getTransactionFee() const { return getValueFieldAmount(sfFee); }
|
||||||
void setTransactionFee(const STAmount& fee);
|
void setTransactionFee(const STAmount& fee) { setValueFieldAmount(sfFee, fee); }
|
||||||
|
|
||||||
const NewcoinAddress& getSourceAccount() const { return mSourceAccount; }
|
NewcoinAddress getSourceAccount() const { return getValueFieldAccount(sfAccount); }
|
||||||
std::vector<unsigned char> getSigningPubKey() const;
|
std::vector<unsigned char> getSigningPubKey() const;
|
||||||
const std::vector<unsigned char>& peekSigningPubKey() const;
|
void setSigningPubKey(const NewcoinAddress& naSignPubKey);
|
||||||
std::vector<unsigned char>& peekSigningPubKey();
|
void setSourceAccount(const NewcoinAddress& naSource);
|
||||||
const NewcoinAddress& setSigningPubKey(const NewcoinAddress& naSignPubKey);
|
|
||||||
const NewcoinAddress& setSourceAccount(const NewcoinAddress& naSource);
|
|
||||||
std::string getTransactionType() const { return mFormat->t_name; }
|
std::string getTransactionType() const { return mFormat->t_name; }
|
||||||
|
|
||||||
// inner transaction functions
|
uint32 getSequence() const { return getValueFieldU32(sfSequence); }
|
||||||
uint32 getFlags() const { return mInnerTxn.getFlags(); }
|
void setSequence(uint32 seq) { return setValueFieldU32(sfSequence, seq); }
|
||||||
void setFlag(uint32 v) { mInnerTxn.setFlag(v); }
|
|
||||||
void clearFlag(uint32 v) { mInnerTxn.clearFlag(v); }
|
|
||||||
|
|
||||||
uint32 getSequence() const;
|
// inner transaction field functions (OBSOLETE - use STObject functions)
|
||||||
void setSequence(uint32);
|
int getITFieldIndex(SField::ref field) const { return getFieldIndex(field); }
|
||||||
|
const SerializedType& peekITField(SField::ref field) const { return peekAtField(field); }
|
||||||
|
SerializedType& getITField(SField::ref field) { return getField(field); }
|
||||||
|
|
||||||
// inner transaction field functions
|
// inner transaction field value functions (OBSOLETE - use STObject functions)
|
||||||
int getITFieldIndex(SField::ref field) const;
|
std::string getITFieldString(SField::ref field) const { return getFieldString(field); }
|
||||||
int getITFieldCount() const;
|
unsigned char getITFieldU8(SField::ref field) const { return getValueFieldU8(field); }
|
||||||
const SerializedType& peekITField(SField::ref field) const;
|
uint16 getITFieldU16(SField::ref field) const { return getValueFieldU16(field); }
|
||||||
SerializedType& getITField(SField::ref field);
|
uint32 getITFieldU32(SField::ref field) const { return getValueFieldU32(field); }
|
||||||
|
uint64 getITFieldU64(SField::ref field) const { return getValueFieldU64(field); }
|
||||||
// inner transaction field value functions
|
uint128 getITFieldH128(SField::ref field) const { return getValueFieldH128(field); }
|
||||||
std::string getITFieldString(SField::ref field) const { return mInnerTxn.getFieldString(field); }
|
uint160 getITFieldH160(SField::ref field) const { return getValueFieldH160(field); }
|
||||||
unsigned char getITFieldU8(SField::ref field) const { return mInnerTxn.getValueFieldU8(field); }
|
|
||||||
uint16 getITFieldU16(SField::ref field) const { return mInnerTxn.getValueFieldU16(field); }
|
|
||||||
uint32 getITFieldU32(SField::ref field) const { return mInnerTxn.getValueFieldU32(field); }
|
|
||||||
uint64 getITFieldU64(SField::ref field) const { return mInnerTxn.getValueFieldU64(field); }
|
|
||||||
uint128 getITFieldH128(SField::ref field) const { return mInnerTxn.getValueFieldH128(field); }
|
|
||||||
uint160 getITFieldH160(SField::ref field) const { return mInnerTxn.getValueFieldH160(field); }
|
|
||||||
uint160 getITFieldAccount(SField::ref field) const;
|
uint160 getITFieldAccount(SField::ref field) const;
|
||||||
uint256 getITFieldH256(SField::ref field) const { return mInnerTxn.getValueFieldH256(field); }
|
uint256 getITFieldH256(SField::ref field) const { return getValueFieldH256(field); }
|
||||||
std::vector<unsigned char> getITFieldVL(SField::ref field) const { return mInnerTxn.getValueFieldVL(field); }
|
std::vector<unsigned char> getITFieldVL(SField::ref field) const { return getValueFieldVL(field); }
|
||||||
std::vector<TaggedListItem> getITFieldTL(SField::ref field) const { return mInnerTxn.getValueFieldTL(field); }
|
std::vector<TaggedListItem> getITFieldTL(SField::ref field) const { return getValueFieldTL(field); }
|
||||||
STAmount getITFieldAmount(SField::ref field) const { return mInnerTxn.getValueFieldAmount(field); }
|
STAmount getITFieldAmount(SField::ref field) const { return getValueFieldAmount(field); }
|
||||||
STPathSet getITFieldPathSet(SField::ref field) const { return mInnerTxn.getValueFieldPathSet(field); }
|
STPathSet getITFieldPathSet(SField::ref field) const { return getValueFieldPathSet(field); }
|
||||||
|
|
||||||
void setITFieldU8(SField::ref field, unsigned char v) { return mInnerTxn.setValueFieldU8(field, v); }
|
void setITFieldU8(SField::ref field, unsigned char v) { return setValueFieldU8(field, v); }
|
||||||
void setITFieldU16(SField::ref field, uint16 v) { return mInnerTxn.setValueFieldU16(field, v); }
|
void setITFieldU16(SField::ref field, uint16 v) { return setValueFieldU16(field, v); }
|
||||||
void setITFieldU32(SField::ref field, uint32 v) { return mInnerTxn.setValueFieldU32(field, v); }
|
void setITFieldU32(SField::ref field, uint32 v) { return setValueFieldU32(field, v); }
|
||||||
void setITFieldU64(SField::ref field, uint32 v) { return mInnerTxn.setValueFieldU64(field, v); }
|
void setITFieldU64(SField::ref field, uint32 v) { return setValueFieldU64(field, v); }
|
||||||
void setITFieldH128(SField::ref field, const uint128& v) { return mInnerTxn.setValueFieldH128(field, v); }
|
void setITFieldH128(SField::ref field, const uint128& v) { return setValueFieldH128(field, v); }
|
||||||
void setITFieldH160(SField::ref field, const uint160& v) { return mInnerTxn.setValueFieldH160(field, v); }
|
void setITFieldH160(SField::ref field, const uint160& v) { return setValueFieldH160(field, v); }
|
||||||
void setITFieldH256(SField::ref field, const uint256& v) { return mInnerTxn.setValueFieldH256(field, v); }
|
void setITFieldH256(SField::ref field, const uint256& v) { return setValueFieldH256(field, v); }
|
||||||
void setITFieldVL(SField::ref field, const std::vector<unsigned char>& v)
|
void setITFieldVL(SField::ref field, const std::vector<unsigned char>& v)
|
||||||
{ return mInnerTxn.setValueFieldVL(field, v); }
|
{ return setValueFieldVL(field, v); }
|
||||||
void setITFieldTL(SField::ref field, const std::vector<TaggedListItem>& v)
|
void setITFieldTL(SField::ref field, const std::vector<TaggedListItem>& v)
|
||||||
{ return mInnerTxn.setValueFieldTL(field, v); }
|
{ return setValueFieldTL(field, v); }
|
||||||
void setITFieldAccount(SField::ref field, const uint160& v)
|
void setITFieldAccount(SField::ref field, const uint160& v)
|
||||||
{ return mInnerTxn.setValueFieldAccount(field, v); }
|
{ return setValueFieldAccount(field, v); }
|
||||||
void setITFieldAccount(SField::ref field, const NewcoinAddress& v)
|
void setITFieldAccount(SField::ref field, const NewcoinAddress& v)
|
||||||
{ return mInnerTxn.setValueFieldAccount(field, v); }
|
{ return setValueFieldAccount(field, v); }
|
||||||
void setITFieldAmount(SField::ref field, const STAmount& v)
|
void setITFieldAmount(SField::ref field, const STAmount& v)
|
||||||
{ return mInnerTxn.setValueFieldAmount(field, v); }
|
{ return setValueFieldAmount(field, v); }
|
||||||
void setITFieldPathSet(SField::ref field, const STPathSet& v)
|
void setITFieldPathSet(SField::ref field, const STPathSet& v)
|
||||||
{ return mInnerTxn.setValueFieldPathSet(field, v); }
|
{ return setValueFieldPathSet(field, v); }
|
||||||
|
|
||||||
// optional field functions
|
// optional field functions (OBSOLETE - use STObject functions)
|
||||||
bool getITFieldPresent(SField::ref field) const;
|
bool getITFieldPresent(SField::ref field) const { return isFieldPresent(field); }
|
||||||
void makeITFieldPresent(SField::ref field);
|
void makeITFieldPresent(SField::ref field) { makeFieldPresent(field); }
|
||||||
void makeITFieldAbsent(SField::ref field);
|
void makeITFieldAbsent(SField::ref field) { makeFieldAbsent(field); }
|
||||||
|
|
||||||
std::vector<NewcoinAddress> getAffectedAccounts() const;
|
std::vector<NewcoinAddress> getAffectedAccounts() const;
|
||||||
|
|
||||||
@@ -121,7 +106,7 @@ public:
|
|||||||
|
|
||||||
virtual Json::Value getJson(int options) const;
|
virtual Json::Value getJson(int options) const;
|
||||||
|
|
||||||
bool sign(const NewcoinAddress& naAccountPrivate);
|
void sign(const NewcoinAddress& naAccountPrivate);
|
||||||
bool checkSign(const NewcoinAddress& naAccountPublic) const;
|
bool checkSign(const NewcoinAddress& naAccountPublic) const;
|
||||||
|
|
||||||
// SQL Functions
|
// SQL Functions
|
||||||
|
|||||||
@@ -28,12 +28,6 @@ struct TransactionFormat
|
|||||||
SOElement elements[24];
|
SOElement elements[24];
|
||||||
};
|
};
|
||||||
|
|
||||||
const int TransactionISigningPubKey = 0;
|
|
||||||
const int TransactionISourceID = 1;
|
|
||||||
const int TransactionISequence = 2;
|
|
||||||
const int TransactionIType = 3;
|
|
||||||
const int TransactionIFee = 4;
|
|
||||||
|
|
||||||
const int TransactionMinLen = 32;
|
const int TransactionMinLen = 32;
|
||||||
const int TransactionMaxLen = 1048576;
|
const int TransactionMaxLen = 1048576;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user