trezor / blockbook

:blue_book: Trezor address/account balance backend
https://trezor.io
GNU Affero General Public License v3.0
662 stars 650 forks source link

Add support for BYTZ coin #463

Open olegmitrakhovich opened 4 years ago

olegmitrakhovich commented 4 years ago

I am attempting to make integration tests for a new coin called BYTZ ... when I run make test-integration ARGS="-run=TestIntegration/bytz/" I am getting this:

cd /go/src/github.com/trezor/blockbook && packr clean && packr cd /go/src/github.com/trezor/blockbook && go test -tags integration go list github.com/trezor/blockbook/tests/... -run=TestIntegration/bytz/ --- FAIL: TestIntegration (0.12s) --- FAIL: TestIntegration/bytz=main (0.12s) --- FAIL: TestIntegration/bytz=main/rpc (0.01s) --- FAIL: TestIntegration/bytz=main/rpc/GetTransaction (0.00s) rpc.go:185: GetTransaction() got &bchain.Tx{Hex:"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603392e0d0101ffffffff0100000000000000000000000000", Txid:"64215f794d731e78714de663cdb83e2cf233800e5d4d2cc3d4c235bc4301651f", Version:1, LockTime:0x0, Vin:[]bchain.Vin{bchain.Vin{Coinbase:"03392e0d0101", Txid:"", Vout:0x0, ScriptSig:bchain.ScriptSig{Hex:""}, Sequence:0xffffffff, Addresses:[]string(nil)}}, Vout:[]bchain.Vout{bchain.Vout{ValueSat:big.Int{neg:false, abs:big.nat(nil)}, JsonValue:"", N:0x0, ScriptPubKey:bchain.ScriptPubKey{Hex:"", Addresses:[]string(nil)}}}, BlockHeight:0x0, Confirmations:0x0, Time:1579204856, Blocktime:1579204856, CoinSpecificData:interface {}(nil)}, want &bchain.Tx{Hex:"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603392e0d0101ffffffff0100000000000000000000000000", Txid:"64215f794d731e78714de663cdb83e2cf233800e5d4d2cc3d4c235bc4301651f", Version:1, LockTime:0x0, Vin:[]bchain.Vin{bchain.Vin{Coinbase:"03392e0d0101", Txid:"", Vout:0x0, ScriptSig:bchain.ScriptSig{Hex:""}, Sequence:0xffffffff, Addresses:[]string(nil)}}, Vout:[]bchain.Vout{bchain.Vout{ValueSat:big.Int{neg:false, abs:big.nat(nil)}, JsonValue:"", N:0x0, ScriptPubKey:bchain.ScriptPubKey{Hex:"", Addresses:[]string(nil)}}}, BlockHeight:0x0, Confirmations:0x45c37, Time:1579204856, Blocktime:1579204856, CoinSpecificData:interface {}(nil)} FAIL

Not really understanding what the issue is, since I am not getting an error message that makes sense? (the previous error messages were great and very descriptive).

This is the branch I am using https://github.com/bytzcurrency/BYTZ-blockbook/tree/BYTZ-coin-support and the deployment of the explorer can be found here: https://204.92.235.59:9196/

Any help would be appreciated, Thank you

olegmitrakhovich commented 4 years ago

I added: https://github.com/bytzcurrency/BYTZ-blockbook/commit/1e428b1084d971dc7ace566e232135a2d169f0f3

"handleFork": { "syncRanges": [{ "lower": 863801, "upper": 863801 }], "fakeBlocks": { "863801": { "height": 863801, "hash": "915a2413d358f373be303f242aa92619e6e0eeb16856217140f8749b86acea79" } }, "realBlocks": { "863801": { "height": 863801, "hash": "77a84cf0fc3c98eb5b904355eafdf5ab99c0f6f76ee42755874b3e8d7a8d4764" } } }

to sync\testdata\bytz.json and now I am getting more of a descriptive error:

cd /go/src/github.com/trezor/blockbook && packr clean && packr cd /go/src/github.com/trezor/blockbook && go test -tags integration go list github.com/trezor/blockbook/tests/... -run=TestIntegration/bytz/ E0731 14:57:28.565625 2638 sync.go:299] getBlockWorker 0 connect block error Block not found. Exiting... --- FAIL: TestIntegration (0.17s) --- FAIL: TestIntegration/bytz=main (0.17s) --- FAIL: TestIntegration/bytz=main/rpc (0.01s) --- FAIL: TestIntegration/bytz=main/rpc/GetTransaction (0.00s) rpc.go:185: GetTransaction() got &bchain.Tx{Hex:"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603392e0d0101ffffffff0100000000000000000000000000", Txid:"64215f794d731e78714de663cdb83e2cf233800e5d4d2cc3d4c235bc4301651f", Version:1, LockTime:0x0, Vin:[]bchain.Vin{bchain.Vin{Coinbase:"03392e0d0101", Txid:"", Vout:0x0, ScriptSig:bchain.ScriptSig{Hex:""}, Sequence:0xffffffff, Addresses:[]string(nil)}}, Vout:[]bchain.Vout{bchain.Vout{ValueSat:big.Int{neg:false, abs:big.nat(nil)}, JsonValue:"", N:0x0, ScriptPubKey:bchain.ScriptPubKey{Hex:"", Addresses:[]string(nil)}}}, BlockHeight:0x0, Confirmations:0x0, Time:1579204856, Blocktime:1579204856, CoinSpecificData:interface {}(nil)}, want &bchain.Tx{Hex:"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603392e0d0101ffffffff0100000000000000000000000000", Txid:"64215f794d731e78714de663cdb83e2cf233800e5d4d2cc3d4c235bc4301651f", Version:1, LockTime:0x0, Vin:[]bchain.Vin{bchain.Vin{Coinbase:"03392e0d0101", Txid:"", Vout:0x0, ScriptSig:bchain.ScriptSig{Hex:""}, Sequence:0xffffffff, Addresses:[]string(nil)}}, Vout:[]bchain.Vout{bchain.Vout{ValueSat:big.Int{neg:false, abs:big.nat(nil)}, JsonValue:"", N:0x0, ScriptPubKey:bchain.ScriptPubKey{Hex:"", Addresses:[]string(nil)}}}, BlockHeight:0x0, Confirmations:0x45c37, Time:1579204856, Blocktime:1579204856, CoinSpecificData:interface {}(nil)} --- FAIL: TestIntegration/bytz=main/sync (0.14s) --- FAIL: TestIntegration/bytz=main/sync/HandleFork (0.04s) handlefork.go:35: Upper block height mismatch: 0 != 863801 FAIL