Refactor Bitcoin block parsing to match changes from Bitcoin v0.22 #324

Closed
opened 2022-03-17 22:09:48 +00:00 by serkixenos · 9 comments
serkixenos commented 2022-03-17 22:09:48 +00:00 (Migrated from gitlab.com)

https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-22.0.md

The following RPCs: gettxout, getrawtransaction, decoderawtransaction, decodescript, gettransaction, and REST endpoints: /rest/tx, /rest/getutxos, /rest/block deprecated the following fields (which are no longer returned in the responses by default): addresses, reqSigs. The -deprecatedrpc=addresses flag must be passed for these fields to be included in the RPC response. This flag/option will be available only for this major release, after which the deprecation will be removed entirely. Note that these fields are attributes of the scriptPubKey object returned in the RPC response. However, in the response of decodescript these fields are top-level attributes, and included again as attributes of the scriptPubKey object. (#20286)

Idealy, we want to support both pre and post v0.22

Difference is in scriptPubKey.address vs scriptPubKey.addresses

"tx": [
{
"txid": "c05480e5da3b3e27126c15357057fd468ae990335d4e6cb10b90b1c4ff957ecc",
"hash": "e942c99a94ea5b4e0727cd4de3797ce637e298e721b528156a7fb0a93382374e",
"version": 1,
"size": 2726,
"vsize": 2645,
"weight": 10577,
"locktime": 0,
"vin": [
	{
		"txid": "90b05668c64e5992d443f417f0943046b2fb2659cab0091fc52ceeb38622c6d7",
		"vout": 5,
		"scriptSig": {
			"asm": "",
			"hex": ""
		},
		"txinwitness": [
			"304402203faac0190481f82bd5c4a30319702f4109d8f5c1c2f10fc1c3699f3c9da86cd802205cd4798fef88548e4abae7ecae3398d060f122b578caff2ffa33c14fef97c56801",
			"0243312f392cf042c823c8a1525065cecdf3724c98984b1172152d563d03605761"
		],
		"sequence": 4294967295
	}
],
"vout": [
{
		"value": 0.0001,
		"n": 60,
		"scriptPubKey": {
			"asm": "0 67d05fedb991533891c1aa6bfc1555b385aa9e4536089c345add556ec2e58403",
			"hex": "002067d05fedb991533891c1aa6bfc1555b385aa9e4536089c345add556ec2e58403",
			"address": "bc1qvlg9lmdej9fn3ywp4f4lc924kwz648j9xcyfcdz6m42kash9sspse36m33",
			"type": "witness_v0_scripthash"
		}
	},
        ...
],
...
}
        "scriptPubKey": {
            "asm": "1 030e001332b43924be343986cca3df669f57b0dedd120990e727787f8dea50fdbc 20434e545250525459000000140001a9e0e85838b5000000174876e800010053b6 2 OP_CHECKMULTISIG",
            "hex": "5121030e001332b43924be343986cca3df669f57b0dedd120990e727787f8dea50fdbc2120434e545250525459000000140001a9e0e85838b5000000174876e800010053b652ae",
            "reqSigs": 1,
            "type": "multisig",
            "addresses": [
                "1FrbMcddiM1v3HMpUqygjZYCamBykWCWao"
            ]
        }
https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-22.0.md The following RPCs: gettxout, getrawtransaction, decoderawtransaction, decodescript, gettransaction, and REST endpoints: /rest/tx, /rest/getutxos, /rest/block deprecated the following fields (which are no longer returned in the responses by default): addresses, reqSigs. The -deprecatedrpc=addresses flag must be passed for these fields to be included in the RPC response. This flag/option will be available only for this major release, after which the deprecation will be removed entirely. Note that these fields are attributes of the scriptPubKey object returned in the RPC response. However, in the response of decodescript these fields are top-level attributes, and included again as attributes of the scriptPubKey object. (#20286) Idealy, we want to support both pre and post v0.22 Difference is in scriptPubKey.address vs scriptPubKey.addresses ``` "tx": [ { "txid": "c05480e5da3b3e27126c15357057fd468ae990335d4e6cb10b90b1c4ff957ecc", "hash": "e942c99a94ea5b4e0727cd4de3797ce637e298e721b528156a7fb0a93382374e", "version": 1, "size": 2726, "vsize": 2645, "weight": 10577, "locktime": 0, "vin": [ { "txid": "90b05668c64e5992d443f417f0943046b2fb2659cab0091fc52ceeb38622c6d7", "vout": 5, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "304402203faac0190481f82bd5c4a30319702f4109d8f5c1c2f10fc1c3699f3c9da86cd802205cd4798fef88548e4abae7ecae3398d060f122b578caff2ffa33c14fef97c56801", "0243312f392cf042c823c8a1525065cecdf3724c98984b1172152d563d03605761" ], "sequence": 4294967295 } ], "vout": [ { "value": 0.0001, "n": 60, "scriptPubKey": { "asm": "0 67d05fedb991533891c1aa6bfc1555b385aa9e4536089c345add556ec2e58403", "hex": "002067d05fedb991533891c1aa6bfc1555b385aa9e4536089c345add556ec2e58403", "address": "bc1qvlg9lmdej9fn3ywp4f4lc924kwz648j9xcyfcdz6m42kash9sspse36m33", "type": "witness_v0_scripthash" } }, ... ], ... } ``` ``` "scriptPubKey": { "asm": "1 030e001332b43924be343986cca3df669f57b0dedd120990e727787f8dea50fdbc 20434e545250525459000000140001a9e0e85838b5000000174876e800010053b6 2 OP_CHECKMULTISIG", "hex": "5121030e001332b43924be343986cca3df669f57b0dedd120990e727787f8dea50fdbc2120434e545250525459000000140001a9e0e85838b5000000174876e800010053b652ae", "reqSigs": 1, "type": "multisig", "addresses": [ "1FrbMcddiM1v3HMpUqygjZYCamBykWCWao" ] } ```
serkixenos commented 2022-03-18 17:11:08 +00:00 (Migrated from gitlab.com)

mentioned in issue #312

mentioned in issue #312
hirunda commented 2022-03-21 22:50:17 +00:00 (Migrated from gitlab.com)

assigned to @hirunda

assigned to @hirunda
serkixenos commented 2022-03-23 17:38:16 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
hirunda commented 2022-03-23 21:45:56 +00:00 (Migrated from gitlab.com)

Test instructions:

  1. Use peerplays-qa-environment with bitcoin image version 21 (Check for the line in docker file where we download version 21)
  2. Build peerplays-qa-environment
  3. Run the command: docker-compose up bitcoin-for-peerplays
  4. Run the command: docker exec -it peerplays-qa-environment_bitcoin-for-peerplays_1 /bin/bash
  5. Run the command: ./init-network.sh
  6. Wait for bitcoin to finish with initialization
  7. Run the command: docker-compose up peerplays-all-in-one
  8. Check for log: sidechain_net_handler_bitcoin.cpp:1001 sidechain_net_handle ] Bitcoin major version is: '21'
  9. Run the command: docker exec -it peerplays-all-in-one /bin/bash
  10. Run the command: ./init-network.sh
  11. Wait for peerplays to finish with initialization

  1. The following testing should cover deposit transfer, withdrawal and change of active sons
    If all tests are passing, please move on 13)

  2. Repeat all steps from 1) - 12) except in 1) use bitcoin image version 22

Test instructions: 1) Use peerplays-qa-environment with bitcoin image version 21 (Check for the line in docker file where we download version 21) 2) Build peerplays-qa-environment 3) Run the command: docker-compose up bitcoin-for-peerplays 4) Run the command: docker exec -it peerplays-qa-environment_bitcoin-for-peerplays_1 /bin/bash 5) Run the command: ./init-network.sh 6) Wait for bitcoin to finish with initialization 7) Run the command: docker-compose up peerplays-all-in-one 8) Check for log: sidechain_net_handler_bitcoin.cpp:1001 sidechain_net_handle ] **Bitcoin major version is: '21'** 9) Run the command: docker exec -it peerplays-all-in-one /bin/bash 10) Run the command: ./init-network.sh 11) Wait for peerplays to finish with initialization ------------------------------------------------------ 12) The following testing should cover deposit transfer, withdrawal and change of active sons If all tests are passing, please move on 13) 13) Repeat all steps from 1) - 12) except in 1) use bitcoin image version 22
prandnum commented 2022-03-31 16:40:03 +00:00 (Migrated from gitlab.com)

bitcoin withdrawal is failing while verifying this bug. logs attached and shared with Davor

peerplays01.zip

bitcoin withdrawal is failing while verifying this bug. logs attached and shared with Davor [peerplays01.zip](/uploads/c06bc7d5c39f773c4985568187e8e425/peerplays01.zip)
prandnum commented 2022-04-02 14:35:20 +00:00 (Migrated from gitlab.com)

one of the peerplays container(peerplays01) restarted. the logs were shared with Davor.also attaching here.

putty-3.99.43.17-31-03-2022-202049.log

one of the peerplays container(peerplays01) restarted. the logs were shared with Davor.also attaching here. [putty-3.99.43.17-31-03-2022-202049.log](/uploads/ba2b4c24a67440bce4a84e8d9f87a581/putty-3.99.43.17-31-03-2022-202049.log)
hirunda commented 2022-04-03 16:56:53 +00:00 (Migrated from gitlab.com)

Hi Kiran,

This is known issue which is not related to the changes done to resolve this issue.
Please open the new issue with your findings, and move forward with testing bitcoin v21 and v22 which is specific to this one.

Hi Kiran, This is known issue which is not related to the changes done to resolve this issue. Please open the new issue with your findings, and move forward with testing bitcoin v21 and v22 which is specific to this one.
prandnum commented 2022-04-04 12:56:51 +00:00 (Migrated from gitlab.com)

sure Davor. Raised #338 for the restart

sure Davor. Raised #338 for the restart
prandnum commented 2022-04-04 18:36:02 +00:00 (Migrated from gitlab.com)

The following 6 scenarios are tested
With v21:

  1. BTC withdraw
  2. BTC deposit
  3. active SON account change(by stopping active witnesses containers)

With v22:

  1. BTC withdraw
  2. BTC deposit
  3. active SON account change(by stopping active witnesses containers)
The following 6 scenarios are tested With v21: 1) BTC withdraw 2) BTC deposit 3) active SON account change(by stopping active witnesses containers) With v22: 1) BTC withdraw 2) BTC deposit 3) active SON account change(by stopping active witnesses containers)
prandnum (Migrated from gitlab.com) closed this issue 2022-04-04 18:36:03 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#324
No description provided.