[RPC] Add import/removeprunedfunds rpc call #7558

pull instagibbs wants to merge 2 commits into bitcoin:master from instagibbs:prunedforport changing 13 files +351 −23
  1. instagibbs commented at 1:13 am on February 19, 2016: member

    This allows wallets to import funds without a rescan. It required an address or private key to exist in the wallet before calling. Primarily to be used to import funds to a pruned wallet, but could be used in conjunction with importaddress/privkey without rescan on an archival node.

    A companion RPC call “removeprunedfunds” is added to allow the user to delete erroneous imported funds.

  2. instagibbs renamed this:
    Add importprunedfunds rpc call
    [RPC] Add importprunedfunds rpc call
    on Feb 19, 2016
  3. gmaxwell commented at 1:47 am on February 19, 2016: contributor

    Concept ACK.

    What happens if I import a fully spent transaction but fail to import the transaction(s) spending it’s outputs?

  4. sipa commented at 1:48 am on February 19, 2016: member

    What happens if I import a fully spent transaction but fail to import the transaction(s) spending it’s outputs?

    You are eaten by a grue.

  5. gmaxwell commented at 1:58 am on February 19, 2016: contributor
    One could avoid the grue eating by using a lantern, I mean, checking if the output is still spendable and setting a flag… perhaps?
  6. paveljanik commented at 7:21 am on February 19, 2016: contributor

    The build fails with this on some systems:

    0/bin/sh: 1: /home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/importprunedfunds.py: Permission denied
    
  7. laanwj commented at 9:53 am on February 19, 2016: member
    Concept ACK, +1 for the grue
  8. jonasschnelli added the label Wallet on Feb 19, 2016
  9. in src/wallet/rpcdump.cpp: in f9c0c0eca0 outdated
    253+    if (fHelp || params.size() < 2 || params.size() > 3)
    254+        throw runtime_error(
    255+            "importprunedfunds\n"
    256+            "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets.\n"
    257+            "\nArguments:\n"
    258+            "1. \"rawtransaction\" (string, hex, required) A raw transaction funding an already-existing address in wallet\n"
    


    jonasschnelli commented at 12:46 pm on February 19, 2016:
    nit: (string, required) would be the pattern that matches with other rpc commands help. Hex as string type is mostly mentioned in the parameters description.
  10. jonasschnelli commented at 12:50 pm on February 19, 2016: contributor
    Nice and clean PR. Concept ACK.
  11. jonasschnelli commented at 1:24 pm on February 19, 2016: contributor
    And @paveljanik is right: importprunedfunds.py needs a -rwxr-xr-x file permissions mode.
  12. instagibbs force-pushed on Feb 19, 2016
  13. instagibbs commented at 8:06 pm on February 19, 2016: member

    @sipa @gmaxwell

    Seems the easiest way to do this is mark outputs as spent or not, and modify all functions which tally funds to account for this. For now the wallet simply checks if things are spent by looking through its wallet and looking for spends.

  14. instagibbs commented at 8:16 pm on February 19, 2016: member

    Alternatively, when computing available funds we can check if each output is available directly in the utxo set, rather than (just?) looking at wallet transactions.

    I don’t know the internals well enough to know which is best, or if these are both terrible ideas. Especially in the presence of reorgs.

  15. sipa commented at 8:32 pm on February 19, 2016: member

    Marking outputs as spent is very complicated, as spendability depends on whether other transactions exist that spend them, which themselves may be in conflict with the blockchain.

    We can check the UTXO set for spendability in theory, but that introduces yet another dependency between the wallet and the node, and is something that fundamentally requires a trusted full node.

    IMHO, if you’re manually importing transactions, you’re bypassing the entire sync mechanism, it’s your responsibility to also import whatever other transactions that may be relevant.

  16. instagibbs commented at 8:38 pm on February 19, 2016: member

    That was my feeling after digging around and thinking about it. On Feb 19, 2016 12:33 PM, “Pieter Wuille” notifications@github.com wrote:

    Marking outputs as spent is very complicated, as spendability depends on whether other transactions exist that spend them, which themselves may be in conflict with the blockchain.

    We can check the UTXO set for spendability in theory, but that introduces yet another dependency between the wallet and the node, and is something that fundamentally requires a trusted full node.

    IMHO, if you’re manually importing transactions, you’re bypassing the entire sync mechanism, it’s your responsibility to also import whatever other transactions that may be relevant.

    — Reply to this email directly or view it on GitHub #7558 (comment).

  17. instagibbs force-pushed on Feb 25, 2016
  18. instagibbs commented at 1:53 pm on March 7, 2016: member
    Added a companion RPC call to allow removal of imported transactions.
  19. instagibbs renamed this:
    [RPC] Add importprunedfunds rpc call
    [RPC] Add import/removeprunedfunds rpc call
    on Mar 7, 2016
  20. laanwj commented at 2:43 pm on March 7, 2016: member

    Added a companion RPC call to allow removal of imported transactions.

    Nice!

  21. instagibbs commented at 6:58 pm on March 10, 2016: member
    Fixed the undefined behavior that was causing the test to throw an error.
  22. instagibbs force-pushed on Mar 14, 2016
  23. instagibbs commented at 2:01 pm on March 14, 2016: member
    Squashed.
  24. Add importprunedfunds rpc call 7eb702954e
  25. Added companion removeprunedfunds call. f1bb13c93d
  26. instagibbs force-pushed on Mar 23, 2016
  27. instagibbs commented at 2:50 pm on March 23, 2016: member
    rebased
  28. laanwj commented at 9:15 am on March 29, 2016: member
    utACK 7eb7029
  29. laanwj merged this on Mar 29, 2016
  30. laanwj closed this on Mar 29, 2016

  31. laanwj referenced this in commit b35a591793 on Mar 29, 2016
  32. codablock referenced this in commit d0c1efa98e on Sep 16, 2017
  33. codablock referenced this in commit ba478f4746 on Sep 19, 2017
  34. codablock referenced this in commit 0c8de19050 on Dec 9, 2017
  35. codablock referenced this in commit e2fefa539d on Dec 19, 2017
  36. MarcoFalke locked this on Sep 8, 2021

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-11-24 06:12 UTC

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