Error while syncing, ByteStream fatal error
andresVillagomez opened this issue · 1 comments
I've changed the DashKit configuration related to Network settings (such as protocolVersion, dnsSeed, port, etc) in order to access and manipulate an AltCoin network. The library seems to work just fine, excepts that when synchronization is over (kitStateUpdated reports a synced status) the app crashes.
The issue is reported to be on line 29 of file ByteStream.swift. Xcode reports an error called Thread 19: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) and it's caused by this line of code: version = byteStream.read(UInt16.self) on CoinbaseTransaction.swift over DashKit.
The library seems to work just fine whit the predefined configuration.
This are the changes I've made on DashKit.swift > TestNet.swift
let protocolVersion: Int32 = 70213
let name = "devnet-nextnet"
let pubKeyHash: UInt8 = 0x8c
let privateKey: UInt8 = 0xef
let scriptHash: UInt8 = 0x13
let bech32PrefixPattern: String = "dash"
let xPubKey: UInt32 = 0x043587cf
let xPrivKey: UInt32 = 0x04358394
let magic: UInt32 = 0xe2caffce
let port: UInt32 = 19979
let coinType: UInt32 = 1
let sigHash: SigHashType = .bitcoinAll
var syncableFromApi: Bool = true
let dnsSeeds = [
"104.192.6.47"
]
I tried to reproduce the crash, but the "104.192.6.47" keeps disconnected right after first "getblocks" message
The reason of the crash is that the message received from the altcoin node has a different structure. This kit is tested only with Bitcoin, BitcoinCash or Dash. We don't support any other coins or extensions. But you may extend it and use with any altcoin you want.