rpc: Add testmempoolaccept #11742

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:Mf1711-rpcMempoolAcceptOne changing 10 files +399 −14
  1. MarcoFalke commented at 1:49 pm on November 21, 2017: member

    To check if a single raw transaction makes it into the current transaction pool, one had to call sendrawtransaction. However, on success, this adds the transaction to the mempool with no easy way to undo.

    The call testmempoolaccept is introduced to provide a way to solely check the result without changing the mempool state.

  2. MarcoFalke added the label RPC/REST/ZMQ on Nov 21, 2017
  3. MarcoFalke added the label Validation on Nov 21, 2017
  4. in src/rpc/rawtransaction.cpp:1149 in fae1cbbc93 outdated
     996+            "testmempoolaccept \"hexstring\" ( allowhighfees )\n"
     997+            "\nReturns if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n"
     998+            "\nAlso see sendrawtransaction call.\n"
     999+            "\nArguments:\n"
    1000+            "1. \"hexstring\"    (string, required) The hex string of the raw transaction)\n"
    1001+            "2. allowhighfees    (boolean, optional, default=false) Allow high fees\n"
    


    promag commented at 3:43 pm on November 21, 2017:
    Fix alignment.

    MarcoFalke commented at 6:22 pm on November 22, 2017:
    done
  5. in src/rpc/rawtransaction.cpp:1198 in fae1cbbc93 outdated
    1035+    }
    1036+
    1037+    UniValue result(UniValue::VOBJ);
    1038+    result.push_back(Pair("hex", tx_hash.GetHex()));
    1039+
    1040+    {
    


    promag commented at 3:44 pm on November 21, 2017:
    IMO as it is this block is not needed.
  6. in src/rpc/rawtransaction.cpp:1047 in fae1cbbc93 outdated
    1042+        const CCoinsViewCache& view = *pcoinsTip;
    1043+        for (size_t o = 0; o < tx->vout.size(); o++) {
    1044+            bool is_tx_in_chain = !view.AccessCoin(COutPoint(tx_hash, o)).IsSpent();
    1045+            if (is_tx_in_chain) {
    1046+                result.push_back(Pair("allowed", false));
    1047+                result.push_back(Pair("error", "transaction already in block chain"));
    


    promag commented at 3:45 pm on November 21, 2017:
    Add test?
  7. in src/validation.cpp:4651 in fae1cbbc93 outdated
    4394@@ -4386,7 +4395,8 @@ bool LoadMempool(void)
    4395             if (nTime + nExpiryTimeout > nNow) {
    4396                 LOCK(cs_main);
    4397                 AcceptToMemoryPoolWithTime(chainparams, mempool, state, tx, nullptr /* pfMissingInputs */, nTime,
    4398-                                           nullptr /* plTxnReplaced */, false /* bypass_limits */, 0 /* nAbsurdFee */);
    4399+                                           nullptr /* plTxnReplaced */, false /* bypass_limits */, 0 /* nAbsurdFee */,
    4400+                                           nullptr /* test_accept */);
    


    promag commented at 3:49 pm on November 21, 2017:
    Already default value. Or remove default value from declaration?

    MarcoFalke commented at 6:21 pm on November 22, 2017:
    Note this is ATMPWT, not ATMP ;)

    promag commented at 6:32 pm on November 22, 2017:
    Ah!
  8. promag commented at 3:52 pm on November 21, 2017: member
    Should note that two equal calls to testmempoolaccept in a short period can return different values?
  9. MarcoFalke force-pushed on Nov 22, 2017
  10. MarcoFalke force-pushed on Nov 22, 2017
  11. in src/rpc/rawtransaction.cpp:1081 in e0c1f05585 outdated
    1077@@ -998,6 +1078,7 @@ static const CRPCCommand commands[] =
    1078     { "rawtransactions",    "sendrawtransaction",     &sendrawtransaction,     {"hexstring","allowhighfees"} },
    1079     { "rawtransactions",    "combinerawtransaction",  &combinerawtransaction,  {"txs"} },
    1080     { "rawtransactions",    "signrawtransaction",     &signrawtransaction,     {"hexstring","prevtxs","privkeys","sighashtype"} }, /* uses wallet if enabled */
    1081+    { "rawtransactions",    "testmempoolaccept",      &testmempoolaccept,       {"hexstring","allowhighfees"} },
    


    promag commented at 6:35 pm on November 22, 2017:
    Extra space.
  12. in src/rpc/rawtransaction.cpp:1013 in e0c1f05585 outdated
    1008+            "\nExamples:\n"
    1009+            "\nCreate a transaction\n"
    1010+            + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
    1011+            "Sign the transaction, and get back the hex\n"
    1012+            + HelpExampleCli("signrawtransaction", "\"myhex\"") +
    1013+            "\nSend the transaction (signed hex)\n"
    


    promag commented at 6:37 pm on November 22, 2017:
    Send?
  13. in src/rpc/rawtransaction.cpp:1006 in e0c1f05585 outdated
    1001+            "2. allowhighfees    (boolean, optional, default=false) Allow high fees\n"
    1002+            "\nResult:\n"
    1003+            "{\n"
    1004+            "  \"hex\"            (string) The transaction hash in hex\n"
    1005+            "  \"allowed\"        (boolean) If the mempool allows this tx to be inserted\n"
    1006+            "  \"reject-reason\"  (string) rejection string (if any)\n"
    


    promag commented at 6:41 pm on November 22, 2017:
    error? optional?
  14. MarcoFalke force-pushed on Nov 30, 2017
  15. MarcoFalke force-pushed on Dec 6, 2017
  16. in src/txmempool.h:581 in fa12a9481e outdated
    577@@ -578,7 +578,7 @@ class CTxMemPool
    578     /** Populate setDescendants with all in-mempool descendants of hash.
    579      *  Assumes that setDescendants includes all in-mempool descendants of anything
    580      *  already in it.  */
    581-    void CalculateDescendants(txiter it, setEntries &setDescendants);
    582+    void CalculateDescendants(const txiter it, setEntries& setDescendants) const;
    


    sipa commented at 4:27 am on December 6, 2017:
    This first const has no effect.
  17. sipa commented at 4:31 am on December 6, 2017: member
    utACK fa12a9481ea7d930c75f109f3c10b200db70e501
  18. NicolasDorier commented at 4:57 am on December 6, 2017: contributor
    I am so happy about this, big concept ACK. Some tests would be nice.
  19. jonasschnelli commented at 7:07 am on December 6, 2017: contributor

    Nice. Finally. utACK fa12a9481ea7d930c75f109f3c10b200db70e501

    A comment for the new parameter of AcceptToMemoryPool in validation.h would be nice.

  20. in src/rpc/rawtransaction.cpp:1008 in fa12a9481e outdated
    1003+            "\nArguments:\n"
    1004+            "1. \"hexstring\"      (string, required) The hex string of the raw transaction)\n"
    1005+            "2. allowhighfees    (boolean, optional, default=false) Allow high fees\n"
    1006+            "\nResult:\n"
    1007+            "{\n"
    1008+            "  \"hex\"            (string) The transaction hash in hex\n"
    


    TheBlueMatt commented at 10:21 pm on December 6, 2017:
    Seems somewhat redundant to return the parameter as-is, no?

    MarcoFalke commented at 4:01 am on December 7, 2017:
    Thanks, will rename this to txid and the parameter to rawtx to make clear that they are different.
  21. in src/rpc/rawtransaction.cpp:1045 in fa12a9481e outdated
    1040+
    1041+    UniValue result(UniValue::VOBJ);
    1042+    result.push_back(Pair("hex", tx_hash.GetHex()));
    1043+
    1044+    LOCK(cs_main);
    1045+    const CCoinsViewCache& view = *pcoinsTip;
    


    TheBlueMatt commented at 10:37 pm on December 6, 2017:
    Ugh, I meannnnn, checking against pcoinsTip really sucks. Maybe just call ATMP and then check for the “txn-already-known” return? Or just return false (since its not “accepted to mempool”, so I’d kinda expect that) and the rejection reason will be txn-already-known.

    promag commented at 11:25 pm on December 6, 2017:

    I guess this was borrowed from sendrawtransaction.

    There, there is an extra test bool fHaveMempool = mempool.exists(hashTx), but it could be replaced by checking the ATMP error txn-already-in-mempool.

    However in other PR I recall @sipa said it was kind of bad thing to rely on these rejection reasons.


    MarcoFalke commented at 4:05 am on December 7, 2017:
    Yeah, this is mostly a convenience check to provide a helpful message in case the tx recently confirmed for whatever reason. Otherwise you’d be left with missing_inputs, which is correct but might not be helpful at first.

    MarcoFalke commented at 10:04 pm on December 7, 2017:
    On a second thought, I don’t think it makes sense to have the blockchain check here. Will return false as suggested by @TheBlueMatt
  22. TheBlueMatt commented at 10:37 pm on December 6, 2017: member
    Cool.
  23. in src/rpc/rawtransaction.cpp:1162 in fa12a9481e outdated
    1010+            "  \"reject-reason\"  (string) rejection string (only present when 'allowed'==false)\n"
    1011+            "}\n"
    1012+            "\nExamples:\n"
    1013+            "\nCreate a transaction\n"
    1014+            + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
    1015+            "Sign the transaction, and get back the hex\n"
    


    promag commented at 11:05 pm on December 6, 2017:
    Missing \n.

    MarcoFalke commented at 4:06 pm on December 11, 2017:
    There is no new line to indicate a paragraph, which groups the rpcs into two logical sections.
  24. in src/rpc/rawtransaction.cpp:1010 in fa12a9481e outdated
    1005+            "2. allowhighfees    (boolean, optional, default=false) Allow high fees\n"
    1006+            "\nResult:\n"
    1007+            "{\n"
    1008+            "  \"hex\"            (string) The transaction hash in hex\n"
    1009+            "  \"allowed\"        (boolean) If the mempool allows this tx to be inserted\n"
    1010+            "  \"reject-reason\"  (string) rejection string (only present when 'allowed'==false)\n"
    


    promag commented at 11:12 pm on December 6, 2017:
    when 'allowed' is false

    MarcoFalke commented at 4:14 pm on December 11, 2017:
    Thx, fixed.
  25. promag commented at 11:22 pm on December 6, 2017: member
    Are you planning to add functional test in this PR?
  26. MarcoFalke force-pushed on Dec 11, 2017
  27. MarcoFalke force-pushed on Dec 11, 2017
  28. MarcoFalke force-pushed on Dec 11, 2017
  29. MarcoFalke force-pushed on Dec 11, 2017
  30. MarcoFalke force-pushed on Dec 11, 2017
  31. MarcoFalke force-pushed on Dec 11, 2017
  32. MarcoFalke force-pushed on Dec 13, 2017
  33. MarcoFalke commented at 4:31 am on December 14, 2017: member
    Removed the unused imports to make travis green.
  34. MarcoFalke force-pushed on Dec 18, 2017
  35. instagibbs commented at 2:45 pm on December 19, 2017: member
    can someone remind me why this one is acceptable while the other ~dozen attempts have failed?
  36. NicolasDorier commented at 4:32 pm on December 19, 2017: contributor

    @instagibbs Revelant history #7552 from @laanwj

    I think this one can work because it has a better name. verifyrawtransaction is complex because there is lot’s of bike-shed about the args and what verifying means. The meaning of testmempoolaccept is obvious and can’t be misinterpreted, nor would it make sense to have more parameters.

  37. in src/rpc/rawtransaction.cpp:1060 in 2df0c25133 outdated
    1055+        if (state.IsInvalid()) {
    1056+            result.push_back(Pair("reject-reason", strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason())));
    1057+        } else if (missing_inputs) {
    1058+            result.push_back(Pair("reject-reason", "Missing inputs"));
    1059+        } else {
    1060+            result.push_back(Pair("reject-reason", state.GetRejectReason()));
    


    instagibbs commented at 4:50 pm on December 19, 2017:
    I understand this is reflected in sendraw as well, but humor me: what times is state not IsInvalid but it would reject it?
  38. instagibbs approved
  39. instagibbs commented at 4:59 pm on December 19, 2017: member
    utACK
  40. MarcoFalke commented at 6:18 pm on December 19, 2017: member

    @instagibbs Previous pulls were:

    • #11201: Solves the general case (a list of transactions), but ended up in a state of {WIP, needs review, will revisit later}. Haven’t checked what is actually missing there.
    • #7552: Also solves the general case (a list of transactions), but tried to implement some tx pool checking logic in a separate function. Then people raised concerns that this might result in unwanted behavior. (I.e. verifytransaction tells you everything is fine, but your mempool rejects). Also ended in a state {WIP, needs review, will revisit later}…

    I think this pull (testmempoolaccept) nicely exploits the existing checks for consensus/standardness that are called in ATMP, without touching too much of validation code. A future pull can extend this rpc to take lists of more than one raw transaction and feed them into an ephemeral mempool (e.g. based on the current mempool).

  41. greenaddress commented at 9:17 pm on December 19, 2017: contributor
    conceptACK, seems useful and more accessible/convenient than current alternatives
  42. in src/rpc/rawtransaction.cpp:1002 in fa82ebf6cd outdated
     997+    if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
     998+        throw std::runtime_error(
     999+            // clang-format off
    1000+            "testmempoolaccept [\"rawtxs\"] ( allowhighfees )\n"
    1001+            "\nReturns if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n"
    1002+            "\nThis checks if the transaction violates our consesus or policy rules.\n"
    


    promag commented at 11:26 pm on December 19, 2017:

    Type: consesus.

    Nit, s/our/the.

  43. in src/rpc/rawtransaction.cpp:1003 in fa82ebf6cd outdated
     998+        throw std::runtime_error(
     999+            // clang-format off
    1000+            "testmempoolaccept [\"rawtxs\"] ( allowhighfees )\n"
    1001+            "\nReturns if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n"
    1002+            "\nThis checks if the transaction violates our consesus or policy rules.\n"
    1003+            "\nAlso see sendrawtransaction call.\n"
    


    promag commented at 11:26 pm on December 19, 2017:
    Nit, just See sendrawtransaction.
  44. in src/rpc/rawtransaction.cpp:1034 in fa82ebf6cd outdated
    1029+
    1030+    ObserveSafeMode();
    1031+
    1032+    RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
    1033+    if (request.params[0].get_array().size() != 1) {
    1034+        throw JSONRPCError(RPC_TYPE_ERROR, "Array must contain exactly one raw transaction for now");
    


    promag commented at 11:28 pm on December 19, 2017:
    RPC_INVALID_PARAMETER instead? Type is already correct (it’s an array at least).
  45. in src/rpc/rawtransaction.cpp:1050 in fa82ebf6cd outdated
    1045+    if (!request.params[1].isNull() && request.params[1].get_bool()) {
    1046+        max_raw_tx_fee = 0;
    1047+    }
    1048+
    1049+    UniValue result(UniValue::VARR);
    1050+
    


    promag commented at 11:31 pm on December 19, 2017:
    Nit, remove empty line.
  46. in src/rpc/rawtransaction.cpp:1014 in fa82ebf6cd outdated
    1009+            "[                   (array) The result of the mempool acceptance test for each raw transaction in the input array.\n"
    1010+            "                            Length is exactly one for now.\n"
    1011+            " {\n"
    1012+            "  \"txid\"           (string) The transaction hash in hex\n"
    1013+            "  \"allowed\"        (boolean) If the mempool allows this tx to be inserted\n"
    1014+            "  \"reject-reason\"  (string) rejection string (only present when 'allowed' is false)\n"
    


    promag commented at 11:33 pm on December 19, 2017:
    Nit, upper case Rejection.
  47. in src/rpc/rawtransaction.cpp:1174 in fa82ebf6cd outdated
    1027+            );
    1028+    }
    1029+
    1030+    ObserveSafeMode();
    1031+
    1032+    RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
    


    promag commented at 11:34 pm on December 19, 2017:
    Remove? Below there is request.params[0].get_array() and request.params[1].get_bool().

    MarcoFalke commented at 9:57 pm on December 20, 2017:
    That is the way we do it everywhere. I assume the rational is to fail early and provide useful feedback instead of accepting/processing each parameter separately and leaving any later ones unchecked.

    promag commented at 10:07 pm on December 20, 2017:
    The error would be different thought. I don’t think failing a bit later is that bad. This also doesn’t work well with polymorphic arguments. At the end we have a mix of these, so I tend to use univalue getters to validate. We could add support to throw if any extra parameter is not get/validated.

    MarcoFalke commented at 10:17 pm on December 20, 2017:
    Yes, the error is different in that the RPCTypeCheck will tell you what the wrong type was, which is useful. I fail to see how the edge case of polymorphic arguments is relevant to this pull request.

    promag commented at 4:34 pm on March 24, 2018:
    nit, missing test for second argument type and also tests for missing/extra arguments.
  48. in src/rpc/rawtransaction.cpp:1059 in fa82ebf6cd outdated
    1054+    LOCK(cs_main);
    1055+
    1056+    CValidationState state;
    1057+    bool missing_inputs;
    1058+    bool test_accept_res;
    1059+    bool res = AcceptToMemoryPool(mempool, state, std::move(tx), &missing_inputs,
    


    promag commented at 11:37 pm on December 19, 2017:

    Nit, we could avoid loose locks, I mean, it’s more clear where the lock/unlock happens:

    0{
    1    LOCK(cs_main);
    2    bool res = AcceptToMemoryPool(...);
    3    assert(!res);
    4}
    
  49. in src/rpc/rawtransaction.cpp:1067 in fa82ebf6cd outdated
    1062+    result_0.pushKV("allowed", test_accept_res);
    1063+    if (!test_accept_res) {
    1064+        if (state.IsInvalid()) {
    1065+            result_0.pushKV("reject-reason", strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
    1066+        } else if (missing_inputs) {
    1067+            result_0.pushKV("reject-reason", "Missing inputs");
    


    promag commented at 11:40 pm on December 19, 2017:
    Nit, not sure if relevant at all, but this format doesn’t match with others. How about missing-inputs?
  50. MarcoFalke commented at 10:17 pm on December 20, 2017: member
    Added a commit to address @promag’s feedback.
  51. laanwj commented at 5:03 pm on February 16, 2018: member
    Concept ACK
  52. MarcoFalke force-pushed on Feb 16, 2018
  53. MarcoFalke force-pushed on Feb 16, 2018
  54. conscott commented at 6:20 pm on March 5, 2018: contributor

    Looks like tests are failing because getnewaddress has changed to default to p2sh-segwit, changing virtual tx size, and some of the fail cases dealing with large txs are no longer triggered. I was able to get everything passing again with trivial changes but you may want to tweak those numbers to line up with expected boundaries.

    Tests also pass again if specifically using “legacy” addresses like:

    0node.getnewaddress("", "legacy")
    

    Perhaps the test can be updated to handle both cases?

  55. in src/validation.cpp:942 in faa03a6dad outdated
    936@@ -934,6 +937,11 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
    937             }
    938         }
    939 
    940+        if (test_accept) {
    941+            *test_accept = true;
    942+            return false;
    


    luke-jr commented at 5:00 pm on March 7, 2018:
    Why not use the return value, instead of modifying a pointer?

    MarcoFalke commented at 2:54 pm on March 8, 2018:
    To keep the interface clear. It wasn’t accepted to the memory pool, which is what the return value of ATMP denotes.

    luke-jr commented at 7:10 pm on March 11, 2018:
    It was accepted, just not added… Acceptance is exactly what you’re testing here. IMO the interface is less clear the way you have it.

    MarcoFalke commented at 3:16 pm on March 24, 2018:
    Makes sense. Fixed
  56. in src/rpc/rawtransaction.cpp:1203 in faa03a6dad outdated
    1089+        LOCK(cs_main);
    1090+        bool res = AcceptToMemoryPool(mempool, state, std::move(tx), &missing_inputs,
    1091+            nullptr /* plTxnReplaced */, false /* bypass_limits */, max_raw_tx_fee, &test_accept_res);
    1092+        assert(!res);
    1093+    }
    1094+    result_0.pushKV("allowed", test_accept_res);
    


    luke-jr commented at 9:03 pm on March 7, 2018:

    pushKV actually doesn’t work with bool… :/

    Guess we need push_back(Pair()) for this.


    promag commented at 9:23 pm on March 7, 2018:
    @luke-jr What do you mean with “doesn’t work”? It’s used in a lot of places.

    MarcoFalke commented at 2:53 pm on March 8, 2018:
    Should work on master, at least: fa1388edb17fc9eca097d93542f8d5db5aa0cf17

    luke-jr commented at 7:12 pm on March 11, 2018:
    Can’t assume the bundled univalue is being used (we really shouldn’t be bundling it at all).

    luke-jr commented at 7:12 pm on March 11, 2018:
    Since this problem exists already in master, #12666 seems like the best path forward.
  57. in src/rpc/rawtransaction.cpp:1142 in faa03a6dad outdated
    1023@@ -1024,6 +1024,88 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
    1024     return hashTx.GetHex();
    1025 }
    1026 
    1027+UniValue testmempoolaccept(const JSONRPCRequest& request)
    1028+{
    1029+    if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
    1030+        throw std::runtime_error(
    1031+            // clang-format off
    1032+            "testmempoolaccept [\"rawtxs\"] ( allowhighfees )\n"
    


    luke-jr commented at 3:38 am on March 8, 2018:
    Accepting/returning a list here makes no sense. Just batch request…

    MarcoFalke commented at 2:52 pm on March 8, 2018:
    I don’t think it is possible to test transactions that depend on each other through a batch request.

    luke-jr commented at 7:11 pm on March 11, 2018:
    I don’t see logic in this PR to actually handle such dependencies either…?

    NicolasDorier commented at 3:58 am on March 12, 2018:
    It is explicitely checked to be size of 1 for now. I think it is reasonable to allow this to be improved in a future PR.
  58. NicolasDorier commented at 4:00 am on March 12, 2018: contributor
    @MarcoFalke can you rebase? I am very interested into having this for new release, will review and test.
  59. instagibbs commented at 4:05 pm on March 23, 2018: member
    Will review after rebase, many have interest in this functionality.
  60. MarcoFalke force-pushed on Mar 24, 2018
  61. MarcoFalke force-pushed on Mar 24, 2018
  62. MarcoFalke force-pushed on Mar 24, 2018
  63. MarcoFalke force-pushed on Mar 24, 2018
  64. MarcoFalke force-pushed on Mar 24, 2018
  65. rpc: Add testmempoolaccept b55555da3e
  66. MarcoFalke force-pushed on Mar 24, 2018
  67. MarcoFalke commented at 3:18 pm on March 24, 2018: member
    @conscott Thanks for looking at this. I have replaced the magic numbers in the test with formulas to fix the issue and make the code more readable.
  68. MarcoFalke commented at 3:18 pm on March 24, 2018: member
  69. promag commented at 4:29 pm on March 24, 2018: member

    Needs release note.

    utACK b55555d.

  70. in src/rpc/rawtransaction.cpp:1148 in b55555da3e
    1143+            "\nReturns if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n"
    1144+            "\nThis checks if the transaction violates the consensus or policy rules.\n"
    1145+            "\nSee sendrawtransaction call.\n"
    1146+            "\nArguments:\n"
    1147+            "1. [\"rawtxs\"]       (array, required) An array of hex strings of raw transactions.\n"
    1148+            "                                        Length must be one for now.\n"
    


    promag commented at 4:30 pm on March 24, 2018:
    Nit, wrong alignment.
  71. sipa commented at 8:00 pm on March 24, 2018: member
    Concept ACK
  72. in src/rpc/rawtransaction.cpp:1201 in b55555da3e
    1196+    bool missing_inputs;
    1197+    bool test_accept_res;
    1198+    {
    1199+        LOCK(cs_main);
    1200+        test_accept_res = AcceptToMemoryPool(mempool, state, std::move(tx), &missing_inputs,
    1201+            nullptr /* plTxnReplaced */, false /* bypass_limits */, max_raw_tx_fee, /* test_accpet */ true);
    


    NicolasDorier commented at 4:07 am on March 25, 2018:
    typo test_accpet
  73. NicolasDorier commented at 4:14 am on March 25, 2018: contributor

    AcceptToMemoryPool AcceptToMemoryPoolWithTime AcceptToMemoryPoolWorker

    Have the following parameter in common

    test_accept, nAbsurdFee, bypass_limits, nAcceptTime

    It would be fine to extract this into a structure like CAcceptToMemoryPoolOptions rather than adding yet one more parameter.

    Anyway, not blocking, CodeReview ACK, will test soon.

  74. MarcoFalke commented at 3:12 pm on March 29, 2018: member
    I can do that refactoring in a follow up pr, if people think that is helpful.
  75. MarcoFalke commented at 8:16 pm on March 30, 2018: member
    Fun-Fact: I just realized an identical implementation was committed in https://github.com/gfanti/bitcoin/commit/7148d4bdfb018235f6be9969148a277ef3fecf9d a year ago. (Not including rpc changes and tests)
  76. MarcoFalke added the label Needs release notes on Apr 1, 2018
  77. laanwj merged this on Apr 2, 2018
  78. laanwj closed this on Apr 2, 2018

  79. laanwj referenced this in commit 18815b4bfb on Apr 2, 2018
  80. jamesob commented at 3:06 pm on April 2, 2018: member

    Post-merge utACK https://github.com/bitcoin/bitcoin/pull/11742/commits/b55555da3e25a47f1e7fced7f09d4f0bf8198624

    Change looks useful and well implemented. The tests are great! In some sense it’s sad that the functional tests you’ve introduced for this particular RPC call are the only place where we’re testing basic mempool rejection logic (e.g. scriptsig-not-pushonly, multi-op-return), but it’s great that we’ve got explicit tests for those cases now.

  81. MarcoFalke deleted the branch on Apr 2, 2018
  82. MarcoFalke removed the label Needs release notes on Apr 2, 2018
  83. instagibbs commented at 6:28 pm on April 2, 2018: member
    yes, forgot to mention the tests were very extensive and impressive
  84. jtimon commented at 2:31 am on April 3, 2018: contributor
    post merge fast review ack. +1 on this being interesting for the tests alone, even if nobody was going to use it (but I know some people will, and I remember concept acking something very similar before, for traceability, #7552 ).
  85. laanwj referenced this in commit f8d6dc47cb on Apr 7, 2018
  86. in src/rpc/rawtransaction.cpp:1176 in b55555da3e
    1171+
    1172+    ObserveSafeMode();
    1173+
    1174+    RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
    1175+    if (request.params[0].get_array().size() != 1) {
    1176+        throw JSONRPCError(RPC_INVALID_PARAMETER, "Array must contain exactly one raw transaction for now");
    


    glozow commented at 5:01 pm on August 12, 2020:
    Hey @MarcoFalke, sorry for the throwback, but was there a plan have testmempoolaccept accept multiple transactions at some point?

    MarcoFalke commented at 8:02 pm on August 12, 2020:
    Yes, see #11742 (comment)

    darosior commented at 12:25 pm on August 19, 2020:
    Fwiw i opened an issue to track this some time ago #18480 . Feel free to pick it up if you want (just signal it so we don’t end up both working on it :) ), as i’m not going to work on this soon.
  87. UdjinM6 referenced this in commit 24c7e146cd on May 21, 2021
  88. UdjinM6 referenced this in commit 5a4f27ff84 on May 21, 2021
  89. UdjinM6 referenced this in commit 3323b65d0c on May 21, 2021
  90. UdjinM6 referenced this in commit cdf2a80c21 on May 21, 2021
  91. UdjinM6 referenced this in commit 34b30bc9f6 on May 21, 2021
  92. UdjinM6 referenced this in commit e4b0a4f0c8 on May 21, 2021
  93. UdjinM6 referenced this in commit 50607de7b2 on May 22, 2021
  94. UdjinM6 referenced this in commit 546c263eab on May 22, 2021
  95. kittywhiskers referenced this in commit f43dcedd10 on May 25, 2021
  96. kittywhiskers referenced this in commit 344b55c081 on May 25, 2021
  97. gades referenced this in commit c99af4b70f on Apr 19, 2022
  98. gades referenced this in commit a7dd9d945a on Apr 29, 2022
  99. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me