Skip to content
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

work around grt rpc not handling old coinbase properly #1795

Closed
wants to merge 1 commit into from

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Nov 20, 2020

No description provided.

@@ -5774,7 +5777,7 @@ func (pgb *ChainDB) GetExplorerTx(txid string) *exptypes.TxInfo {
valueIn, _ := dcrutil.NewAmount(vin.AmountIn)
// Do not attempt to look up prevout if it is a coinbase or stakebase
// input, which does not spend a previous output.
if !(vin.IsCoinBase() || (vin.IsStakeBase() && i == 0)) {
if !(txhelpers.IsCoinbaseVin(vin) || (vin.IsStakeBase() && i == 0)) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you need to do something similar to catch the zeroth treasurybase input here too. e.g. for tx b35eb58a6bb092c251dc4338d0c1c9891ff7786538e432b777f1d545c2ac0958.

2020/11/21 03:50:27 http: panic serving 127.0.0.1:44776: runtime error: index out of range [0] with length 0
...
github.com/decred/dcrdata/db/dcrpg/v5.(*ChainDB).GetExplorerTx(0xc000144d00, 0xc01e7ef333, 0x40, 0xffffffffffffffff)
	/home/buck/programs/dcrdata/db/dcrpg/pgblockchain.go:5837 +0x1c46

But OK with

if !(txhelpers.IsCoinbaseVin(vin) || (txhelpers.IsStakebaseVin(vin) && i == 0) || (i == 0 && standalone.IsTreasuryBase(msgTx))) {

Copy link
Member Author

Choose a reason for hiding this comment

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

I had actually started to update the modules and dependencies, including blockchain/standalone in this branch: https://github.com/chappjc/dcrdata/commits/nomod

But it looks like in a lot of these checks it's sufficient to detect a null prevout https://github.com/decred/dcrd/blob/master/blockchain/standalone/tx.go#L96

@chappjc
Copy link
Member Author

chappjc commented Jan 25, 2021

Superseded by #1796

@chappjc chappjc closed this Jan 25, 2021
@chappjc chappjc deleted the tspend-coinbase-workaround branch January 25, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants