|
|
|
@ -77,6 +77,7 @@ static int AppInitRawTx(int argc, char* argv[])
@@ -77,6 +77,7 @@ static int AppInitRawTx(int argc, char* argv[])
|
|
|
|
|
strUsage += HelpMessageOpt("in=TXID:VOUT(:SEQUENCE_NUMBER)", _("Add input to TX")); |
|
|
|
|
strUsage += HelpMessageOpt("locktime=N", _("Set TX lock time to N")); |
|
|
|
|
strUsage += HelpMessageOpt("nversion=N", _("Set TX version to N")); |
|
|
|
|
strUsage += HelpMessageOpt("rbfoptin(=N)", _("Set RBF opt-in sequence number for input N (if not provided, opt-in all available inputs)")); |
|
|
|
|
strUsage += HelpMessageOpt("outaddr=VALUE:ADDRESS", _("Add address-based output to TX")); |
|
|
|
|
strUsage += HelpMessageOpt("outpubkey=VALUE:PUBKEY[:FLAGS]", _("Add pay-to-pubkey output to TX") + ". " + |
|
|
|
|
_("Optionally add the \"W\" flag to produce a pay-to-witness-pubkey-hash output") + ". " + |
|
|
|
@ -202,6 +203,24 @@ static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
@@ -202,6 +203,24 @@ static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
|
|
|
|
tx.nLockTime = (unsigned int) newLocktime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx) |
|
|
|
|
{ |
|
|
|
|
// parse requested index
|
|
|
|
|
int inIdx = atoi(strInIdx); |
|
|
|
|
if (inIdx < 0 || inIdx >= (int)tx.vin.size()) { |
|
|
|
|
throw std::runtime_error("Invalid TX input index '" + strInIdx + "'"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// set the nSequence to MAX_INT - 2 (= RBF opt in flag)
|
|
|
|
|
int cnt = 0; |
|
|
|
|
for (CTxIn& txin : tx.vin) { |
|
|
|
|
if (strInIdx == "" || cnt == inIdx) { |
|
|
|
|
txin.nSequence = std::numeric_limits<unsigned int>::max() - 2; |
|
|
|
|
} |
|
|
|
|
++cnt; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput) |
|
|
|
|
{ |
|
|
|
|
std::vector<std::string> vStrInputParts; |
|
|
|
@ -649,6 +668,9 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command,
@@ -649,6 +668,9 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command,
|
|
|
|
|
MutateTxVersion(tx, commandVal); |
|
|
|
|
else if (command == "locktime") |
|
|
|
|
MutateTxLocktime(tx, commandVal); |
|
|
|
|
else if (command == "rbfoptin") { |
|
|
|
|
MutateTxRBFOptIn(tx, commandVal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if (command == "delin") |
|
|
|
|
MutateTxDelInput(tx, commandVal); |
|
|
|
|