| 734 | }; |
| 735 | |
| 736 | static void MutateTx(CMutableTransaction& tx, const std::string& command, |
| 737 | const std::string& commandVal) |
| 738 | { |
| 739 | std::unique_ptr<Secp256k1Init> ecc; |
| 740 | |
| 741 | if (command == "nversion") |
| 742 | MutateTxVersion(tx, commandVal); |
| 743 | else if (command == "locktime") |
| 744 | MutateTxLocktime(tx, commandVal); |
| 745 | else if (command == "replaceable") { |
| 746 | MutateTxRBFOptIn(tx, commandVal); |
| 747 | } |
| 748 | |
| 749 | else if (command == "delin") |
| 750 | MutateTxDelInput(tx, commandVal); |
| 751 | else if (command == "in") |
| 752 | MutateTxAddInput(tx, commandVal); |
| 753 | |
| 754 | else if (command == "delout") |
| 755 | MutateTxDelOutput(tx, commandVal); |
| 756 | else if (command == "outaddr") |
| 757 | MutateTxAddOutAddr(tx, commandVal); |
| 758 | else if (command == "outpubkey") { |
| 759 | ecc.reset(new Secp256k1Init()); |
| 760 | MutateTxAddOutPubKey(tx, commandVal); |
| 761 | } else if (command == "outmultisig") { |
| 762 | ecc.reset(new Secp256k1Init()); |
| 763 | MutateTxAddOutMultiSig(tx, commandVal); |
| 764 | } else if (command == "outscript") |
| 765 | MutateTxAddOutScript(tx, commandVal); |
| 766 | else if (command == "outdata") |
| 767 | MutateTxAddOutData(tx, commandVal); |
| 768 | |
| 769 | else if (command == "sign") { |
| 770 | ecc.reset(new Secp256k1Init()); |
| 771 | MutateTxSign(tx, commandVal); |
| 772 | } |
| 773 | |
| 774 | else if (command == "load") |
| 775 | RegisterLoad(commandVal); |
| 776 | |
| 777 | else if (command == "set") |
| 778 | RegisterSet(commandVal); |
| 779 | |
| 780 | else |
| 781 | throw std::runtime_error("unknown command"); |
| 782 | } |
| 783 | |
| 784 | static void OutputTxJSON(const CTransaction& tx) |
| 785 | { |
no test coverage detected