Skip to content

Conversation

@instagibbs
Copy link
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.

@instagibbs instagibbs changed the title Add importprunedfunds rpc call [RPC] Add importprunedfunds rpc call Feb 19, 2016
@gmaxwell
Copy link
Contributor

Concept ACK.

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

@sipa
Copy link
Member

sipa commented Feb 19, 2016

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.

@gmaxwell
Copy link
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?

@paveljanik
Copy link
Contributor

The build fails with this on some systems:

/bin/sh: 1: /home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/importprunedfunds.py: Permission denied

@laanwj
Copy link
Member

laanwj commented Feb 19, 2016

Concept ACK, +1 for the grue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jonasschnelli
Copy link
Contributor

Nice and clean PR.
Concept ACK.

@jonasschnelli
Copy link
Contributor

And @paveljanik is right: importprunedfunds.py needs a -rwxr-xr-x file permissions mode.

@instagibbs
Copy link
Member Author

@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.

@instagibbs
Copy link
Member Author

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.

@sipa
Copy link
Member

sipa commented Feb 19, 2016 via email

@instagibbs
Copy link
Member Author

That was my feeling after digging around and thinking about it.
On Feb 19, 2016 12:33 PM, "Pieter Wuille" [email protected] 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).

@instagibbs
Copy link
Member Author

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

@instagibbs instagibbs changed the title [RPC] Add importprunedfunds rpc call [RPC] Add import/removeprunedfunds rpc call Mar 7, 2016
@laanwj
Copy link
Member

laanwj commented Mar 7, 2016

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

Nice!

@instagibbs
Copy link
Member Author

Fixed the undefined behavior that was causing the test to throw an error.

@instagibbs
Copy link
Member Author

Squashed.

@instagibbs
Copy link
Member Author

rebased

@laanwj
Copy link
Member

laanwj commented Mar 29, 2016

utACK 7eb7029

@laanwj laanwj merged commit f1bb13c into bitcoin:master Mar 29, 2016
laanwj added a commit that referenced this pull request Mar 29, 2016
f1bb13c Added companion removeprunedfunds call. (instagibbs)
7eb7029 Add importprunedfunds rpc call (instagibbs)
@laanwj laanwj mentioned this pull request Mar 29, 2016
@laanwj laanwj mentioned this pull request Mar 30, 2016
16 tasks
codablock pushed a commit to codablock/dash that referenced this pull request Dec 19, 2017
f1bb13c Added companion removeprunedfunds call. (instagibbs)
7eb7029 Add importprunedfunds rpc call (instagibbs)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants