In this commit, we fix a bug that would cause nodes to be unable to
parse a given block from the wire. The block would be properly accepted
if fed in via other mechanisms.
The issue here is that the old checks for the maximum witness size,
circa segwit v0 where placed in the wire package _as well_ as the tx
engine. This check should only be in the engine, since it's properly
gated by other related scrip validation flags.
The fix itself is simple: limit witnesses only based on the maximum
block size in bytes, or ~4MB.
1. Fixed a bug, which reads certs even TLS is disabled
2. Persists Stratum TCP connection with auto-reconnect.
(retry backoff increases from 1s to 60s maximum)
3. Stratum update jobs on previous notifications are canceled
when a new notification arrives.
Usually, the jobs are so short and completed immediately.
However, if the Stratum connection is broken, this prevents
the bridge from accumulating stale jobs.
in the case where you're e.g. trying to connect to an
invalid address, the err vars in handleSendPostMessage()
were being shadowed inside the for loop. if c.httpClient.Do()
returned an error, that error never got returned upstream.
then ioutil.ReadAll(httpResponse.Body) would get a nil pointer
dereference. this fixes that case.
Although the BIPs specify that coinbasetxn and coinbasevalue are
mutually exclusive, both the latest bitcoind (22.0.0) and lbrycrd
(0.17.3) return .coinbasevalue regardeless if 'coinbasetxn' is
specified in the capabilities.
We'll make lbcd behave the same for compatibility.
An output is considered dust if the cost to the network to spend the
coins is more than 1/3 of the minimum free transaction relay fee, which
has a default rate of 1000 satoshis/kb
bitcoind refactored dust threshold calculation, which removed the
multiply factor of 3 from the code, but increased the DUST_RELAY_TX_FEE
from 1000 to 3000 (satoshi/kb).
lbrycrd adopted the refactored code but also kept the rate to
1000 dewies/kB, which means:
An output is considered dust if the cost to the network to spend the
coins is more than the minimum free transaction relay fee.
According to the BIP0009, all active softfork deployment should
be included in the rules.
We add the '!' to indicate the enforcement if the template has
any segwit transactions in it. Otherwise, plain `segwit` is fine.