aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-06-07 18:25:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-06-07 18:25:13 +0200
commit79004d4ae67164d980fdaab4de9d9d467cdb9b88 (patch)
tree7e02c296c5f64dd9ae69d8e07fd926848535b522 /src/rpc
parent22e0b35676230961aeb848a4f5c6b007cb8a43c9 (diff)
parentae357d5ab940dea5e2640361ae17fd8722a93c9f (diff)
Merge #7957: [RPC][Bitcoin-TX] Add support for sequence number
ae357d5 [Bitcoin-Tx] Add tests for sequence number support (Jonas Schnelli) e59336f [bitcoin-tx] allow to set nSequence number over the in= command (Jonas Schnelli) a946bb6 [RPC] createrawtransaction: add option to set the sequence number per input (Jonas Schnelli)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/rawtransaction.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 32b4ad47ff..4517ffcbbc 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -334,6 +334,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
" {\n"
" \"txid\":\"id\", (string, required) The transaction id\n"
" \"vout\":n (numeric, required) The output number\n"
+ " \"sequence\":n (numeric, optional) The sequence number\n"
" }\n"
" ,...\n"
" ]\n"
@@ -384,6 +385,12 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
uint32_t nSequence = (rawTx.nLockTime ? std::numeric_limits<uint32_t>::max() - 1 : std::numeric_limits<uint32_t>::max());
+
+ // set the sequence number if passed in the parameters object
+ const UniValue& sequenceObj = find_value(o, "sequence");
+ if (sequenceObj.isNum())
+ nSequence = sequenceObj.get_int();
+
CTxIn in(COutPoint(txid, nOutput), CScript(), nSequence);
rawTx.vin.push_back(in);