-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2PKH scripts paying P2SH redeemScripts are shown in balance. #377
Comments
Moved to bitpay/bitcore-lib#33 |
Found what seems to be the bug: the DB is indexing redeemScripts and PKHashes identically, so if they collide you will erroneously see a tx you can't spend. This was part of an optimization effort that assumed that the rest of the script was not necessary (only the PKHash). This is not a safe assumption. Since we are matching script types via templating in bitcore-lib /~https://github.com/bitpay/bitcore-lib/blob/master/lib/script/script.js#L307, it is not necessary to hold onto the entire script, but we must hold onto the type. /~https://github.com/bitpay/bitcore-node/blob/master/lib/services/address/index.js#L358 |
- Adds default to store a large portion of the mempool index in leveldb - Includes an option to use memdown to have the mempool index in-memory
Pushing a fix shortly. For an example of this bug, note the transaction credited to: https://test-insight.bitpay.com/address/2MyJ6e284p15EJkFF6LsKSsfiU3jpNPYk5S which is correct, but how it is also incorrectly credited to https://test-insight.bitpay.com/address/mmZpwnnaTfgknuPt1gZEEDXqyAqdsxciTo which is the corresponding P2PKH address. |
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Prevents erroneous crediting of all transactions to both the p2pkh and the corresponding p2sh address.
Fix #377; db must contain hash + type, not just hash.
For example, there are many spam transactions on the blockchain that use a redeemScript in the P2PKH fashion:
This will not be redeemable by a P2SH address, because its script must be:
This is a critical bug IMO as balances on addresses are being reported incorrectly. Any services relying on an Insight service may incorrectly credit an address with a balance it is not actually able to spend.
We should be checking the version type of the address when crediting an output to ensure it is actually spendable.
The text was updated successfully, but these errors were encountered: