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

Add special error for genesis coinbase to getrawtransaction #12278

Merged
merged 1 commit into from Jan 30, 2018
Merged

Add special error for genesis coinbase to getrawtransaction #12278

merged 1 commit into from Jan 30, 2018

Conversation

meshcollider
Copy link
Contributor

@meshcollider meshcollider commented Jan 27, 2018

Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

Just adds a special error message for the genesis block coinbase transaction when using getrawtransaction

Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

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

Concept ACK.

Should throw for testnet and regtest genesis?

Add test for error?

@meshcollider
Copy link
Contributor Author

@promag done, thanks

@luke-jr
Copy link
Member

luke-jr commented Jan 27, 2018

Shouldn't 1) this be part of getrawtransaction primarily, and 2) for gettransaction treat it as if it isn't in the wallet at all?

@meshcollider
Copy link
Contributor Author

@luke-jr oops you're right, wrong RPC. Fixed.

Copy link
Member

@promag promag left a comment

Choose a reason for hiding this comment

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

@luke-jr +1.

@@ -59,6 +59,9 @@ def run_test(self):
self.nodes[0].generate(5)
self.sync_all()

# Test gettransaction on genesis block coinbase returns an error
assert_raises_rpc_error(-5, "The genesis block coinbase is not considered an ordinary transaction", self.nodes[0].getrawtransaction, "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be something like:

block = self.nodes[0].getblock(self.nodes[0].getblockhash(0))
assert_raises_rpc_error(-5, "The genesis block coinbase is not considered an ordinary transaction", self.nodes[0].getrawtransaction, block['merkleroot'])

@@ -146,6 +146,11 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
bool in_active_chain = true;
uint256 hash = ParseHashV(request.params[0], "parameter 1");
CBlockIndex* blockindex = nullptr;

Copy link
Member

Choose a reason for hiding this comment

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

Remove whitespaces.

@meshcollider meshcollider changed the title Add special error for genesis coinbase to gettransaction Add special error for genesis coinbase to getrawtransaction Jan 27, 2018
@meshcollider
Copy link
Contributor Author

Comments addresses, thanks :)

@laanwj
Copy link
Member

laanwj commented Jan 29, 2018

I like that this keeps the error code the same (RPC_INVALID_ADDRESS_OR_KEY) just changes the message to be clearer to users, but from an API point of view there is no change.

utACK 8a758dc

@@ -59,6 +59,10 @@ def run_test(self):
self.nodes[0].generate(5)
self.sync_all()

# Test gettransaction on genesis block coinbase returns an error
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/gettransaction/getrawtransaction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@promag
Copy link
Member

promag commented Jan 29, 2018

utACK ee11121.

@maflcko
Copy link
Member

maflcko commented Jan 29, 2018

utACK

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

utACK ee1112122932151cee06b28ef724e0726849391b
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJab7JwAAoJENLqSFDnUoslf2wP/iYueV2UtyfdzHM+j6sbrMFP
Yb6D3swVRQjwk1iZJDNp6A/HkkanfPNPCcNFLRB5GKWm6oSijWmgBq+2fvGazMqB
TQwV79AsVG/MOJOpzRlmgIixmOFD3cfewUoRdgGwGa7kDuLmgfxt64P8XdTz1hoB
1W254XdJikGgVoFUlpkdTXsHgajcy65iQGBnXBWhyFsLr8Pc6Ceis+WBUgDT6N6W
mK+3H1k6YXqqCzkB90xOC5Hcl5je934aNwZDAvarsiuoGgJYRNGcBSsDShL/e1UJ
E/SG2o8/L7NHSTr1AtQdW2/rR64F2o9Fn/3WcnEKZm1n9aEJYOsWewIlZz0a+Sg4
PCIxknkFgdTotiHeHdfwVpb30ogxDRnWmcYtIXNxK9H62ExnOzJH2dA5y6tdrvjW
ae6KAldambeEUR5WROVTWYieY38y1v2CQHX/8nHCx3Wtaq1iikg5yPsDe7sKTfVS
W9MXhp5TgWSCxOurNSyqgmFxPbeMErJyW3iSOOZ74tvaYdA4Msf0p2q7dtnc6dOL
3bI6kMC9lG5jlDR7G3QPFwOkZ19OyLrCqUiNMN1pmEs+oq4ArIaG6siUUtldDpBi
mxuda6EdCRhIWEuVARnJQLTRsr00x9Exyr4IYpLJ/WjJZG7Et2xTKcqLqlnsov5C
IJjedLTohUyaQB9PuBnh
=mVNm
-----END PGP SIGNATURE-----

@laanwj laanwj merged commit ee11121 into bitcoin:master Jan 30, 2018
laanwj added a commit that referenced this pull request Jan 30, 2018
…tion

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
@meshcollider meshcollider deleted the 201801_genesis_gettransaction_error branch January 30, 2018 09:01
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 17, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
…transaction

ee11121 Add special error for genesis coinbase to gettransaction (MeshCollider)

Pull request description:

  Suggested by sipa here: https://botbot.me/freenode/bitcoin-core-dev/2018-01-23/?msg=96069825&page=2

  Just adds a special error message for the genesis block coinbase transaction when using `getrawtransaction`

Tree-SHA512: cd102c7983ec5457b299bff4b6db747d339fda157933a3ac54aec26b1e48b115aa68c1c9e6cb7a916f15c7786273ab558b2b20ab9768544d211e0ae9d1480e34
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants