|
|
@ -34,9 +34,9 @@ struct Signature |
|
|
|
u256 s; |
|
|
|
}; |
|
|
|
|
|
|
|
// [ nonce, value, baseFee, receiving_address, gas_deposit, [ data byte 0, data byte 1, ... ], v, r, s ]
|
|
|
|
// [ nonce, value, receiveAddress, gasPrice, gasDeposit, data, v, r, s ]
|
|
|
|
// or
|
|
|
|
// [ nonce, endowment, baseFee, [ storage code 1, storage code 2, ... ], v, r, s ]
|
|
|
|
// [ nonce, endowment, 0, gasPrice, gasDeposit (for init), body, init, v, r, s ]
|
|
|
|
struct Transaction |
|
|
|
{ |
|
|
|
Transaction() {} |
|
|
@ -47,23 +47,22 @@ struct Transaction |
|
|
|
bool operator!=(Transaction const& _c) const { return !operator==(_c); } |
|
|
|
|
|
|
|
u256 nonce; ///< The transaction-count of the sender.
|
|
|
|
bool isCreation; ///< Is this a contract-creation transaction?
|
|
|
|
u256 value; ///< The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation transactions.
|
|
|
|
Address receiveAddress; ///< The receiving address of the transaction.
|
|
|
|
u256 gasPrice; ///< The base fee and thus the implied exchange rate of ETH to GAS.
|
|
|
|
Signature vrs; ///< The signature of the transaction. Encodes the sender.
|
|
|
|
u256 gas; ///< The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended.
|
|
|
|
|
|
|
|
// if isCreation:
|
|
|
|
u256s storage; ///< The initial storage of the contract.
|
|
|
|
bytes data; ///< The data associated with the transaction, or the main body if it's a creation transaction.
|
|
|
|
bytes init; ///< The initialisation associated with the transaction.
|
|
|
|
|
|
|
|
// if !isCreation:
|
|
|
|
u256 gas; ///< The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended.
|
|
|
|
Address receiveAddress; ///< The receiving address of the transaction.
|
|
|
|
bytes data; ///< The data associated with the transaction.
|
|
|
|
Signature vrs; ///< The signature of the transaction. Encodes the sender.
|
|
|
|
|
|
|
|
Address safeSender() const noexcept; ///< Like sender() but will never throw.
|
|
|
|
Address sender() const; ///< Determine the sender of the transaction from the signature (and hash).
|
|
|
|
void sign(Secret _priv); ///< Sign the transaction.
|
|
|
|
|
|
|
|
bool isCreation() const { return !receiveAddress; } |
|
|
|
|
|
|
|
static h256 kFromMessage(h256 _msg, h256 _priv); |
|
|
|
|
|
|
|
void fillStream(RLPStream& _s, bool _sig = true) const; |
|
|
@ -78,10 +77,10 @@ using Transactions = std::vector<Transaction>; |
|
|
|
inline std::ostream& operator<<(std::ostream& _out, Transaction const& _t) |
|
|
|
{ |
|
|
|
_out << "{"; |
|
|
|
if (_t.isCreation) |
|
|
|
_out << "[CREATE]"; |
|
|
|
else |
|
|
|
if (_t.receiveAddress) |
|
|
|
_out << _t.receiveAddress.abridged(); |
|
|
|
else |
|
|
|
_out << "[CREATE]"; |
|
|
|
|
|
|
|
_out << "/" << _t.nonce << "$" << _t.value << "+" << _t.gas << "@" << _t.gasPrice; |
|
|
|
Address s; |
|
|
|