Slightly related to #10822 in the sense that I felt the documentation and testing wasn't as good as it could be while writing it.
Ping @sipa since we discussed this on IRC.
948 | - "2. n (numeric, required) vout number\n" 949 | - "3. include_mempool (boolean, optional) Whether to include the mempool\n" 950 | + "1. \"txid\" (string, required) The transaction id\n" 951 | + "2. \"n\" (numeric, required) vout number\n" 952 | + "3. \"include_mempool\" (boolean, optional) Whether to include the mempool. Default: true." 953 | + " Note that an unspent output that is spent in the memepool won't appear.\n"
Wow, such meme, many pool.
hahaha, yeah let's leave a memepool structure for another PR. fixed
btw, hopefully the nit was solved
utACK 7ec368927480c809d27de186690f9d6b6c2e9a9f
55 | @@ -56,6 +56,15 @@ def run_test(self): 56 | assert_equal(len(self.nodes[1].listunspent()), 1) 57 | assert_equal(len(self.nodes[2].listunspent()), 0) 58 | 59 | + self.log.info("test gettxout") 60 | + confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"] 61 | + # First, outputs that are unspent both in the chain and in the 62 | + # mainpool should appear with or without include_mempool
mempool
utACK 7ec368927480c809d27de186690f9d6b6c2e9a9f after fixup
Fixed @MarcoFalke 's nit
55 | @@ -56,6 +56,15 @@ def run_test(self): 56 | assert_equal(len(self.nodes[1].listunspent()), 1) 57 | assert_equal(len(self.nodes[2].listunspent()), 0) 58 | 59 | + self.log.info("test gettxout") 60 | + confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"] 61 | + # First, outputs that are unspent both in the chain and in the 62 | + # mempool should appear with or without include_mempool
Nit, missing period.
62 | + # mempool should appear with or without include_mempool 63 | + txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=False) 64 | + assert_equal(txout['value'], 50) 65 | + txout = self.nodes[0].gettxout(txid=confirmed_txid, n=confirmed_index, include_mempool=True) 66 | + assert_equal(txout['value'], 50) 67 | +
nit: There is trailing whitespace, causing issues with some editors. We don't have this rule in the developer notes, but good to keep in mind for the future.
Perhaps it is time to add it to the notes. Is is save right now to have your editor configured to remove all trailing whitespaces in any file you save in the project now? I remember when that wouldn't be save in the sense that your +14-5 commit would turn into +60-50 or something.
re-utACK 6d2d2eb
943 | @@ -944,9 +944,10 @@ UniValue gettxout(const JSONRPCRequest& request) 944 | "gettxout \"txid\" n ( include_mempool )\n" 945 | "\nReturns details about an unspent transaction output.\n" 946 | "\nArguments:\n" 947 | - "1. \"txid\" (string, required) The transaction id\n" 948 | - "2. n (numeric, required) vout number\n" 949 | - "3. include_mempool (boolean, optional) Whether to include the mempool\n" 950 | + "1. \"txid\" (string, required) The transaction id\n" 951 | + "2. \"n\" (numeric, required) vout number\n"
Nit, vout index?
948 | - "2. n (numeric, required) vout number\n" 949 | - "3. include_mempool (boolean, optional) Whether to include the mempool\n" 950 | + "1. \"txid\" (string, required) The transaction id\n" 951 | + "2. \"n\" (numeric, required) vout number\n" 952 | + "3. \"include_mempool\" (boolean, optional) Whether to include the mempool. Default: true." 953 | + " Note that an unspent output that is spent in the mempool won't appear.\n"
Mixed feelings when reading the note, I thought an unspent output is never spent weather the transaction is in the mempool or not, otherwise is not an unspent output.
Suggestion, remove unspent: Note that an output that is spent in the mempool isn't listed.
@MarcoFalke it's merged but WDYT?
"unspent output" refers to the chainstate, whereas "spent in the mempool" has no effect on the chainstate. Imo it is fine.