diff options
| author | Jonas Schnelli <[email protected]> | 2015-12-22 13:52:57 +0100 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2016-04-27 15:42:14 +0200 |
| commit | a946bb6b182ee169934ffb97940434f38d1ae9e8 (patch) | |
| tree | cef9f921e6eca0b391478969a5e082c5b289c2c3 /src | |
| parent | Merge #7954: build: quiet annoying warnings without adding new ones (diff) | |
| download | discoin-a946bb6b182ee169934ffb97940434f38d1ae9e8.tar.xz discoin-a946bb6b182ee169934ffb97940434f38d1ae9e8.zip | |
[RPC] createrawtransaction: add option to set the sequence number per input
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpc/rawtransaction.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index de8cd68f6..b475f9a22 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); |