deanmlittle / bsv-p2p

A fork of bitcore-p2p for BitcoinSV with bsv.js compatibility.
MIT License
32 stars 15 forks source link

Crash caused by changes that are missing from git history. #16

Open xloem opened 3 years ago

xloem commented 3 years ago

There are some changes from bitcore that seem to be missing from the history. How was the original upload produced? I'm currently running into an issue from this difference:

bitcore-p2p has stop = BufferUtil.NULL_HASH: https://github.com/bitpay/bitcore-p2p/blob/master/lib/messages/utils.js#L110

but bsv-p2p has stop = Buffer.alloc(1): https://github.com/deanmlittle/bsv-p2p/blob/master/lib/messages/utils.js#L112

in bsv-p2p, this unrecorded change causes a crash at https://github.com/deanmlittle/bsv-p2p/blob/master/lib/messages/commands/getheaders.js#L57 where the length is not 32: if (this.stop.length !== 32) { throw new Error('Invalid hash length: ' + this.stop.length); }

xloem commented 3 years ago

I've made https://github.com/xloem/bitcore-p2p-bsv to help me (or others) move through this particular hurdle. EDIT: reviewing the history, it looks like the change in bsv-p2p was just a quick way to handle having removed BufferUtil and is incorrect. I think it should be 32 bytes of zeros.