A new RPC function has been added to the daemon to quickly check for
the existence of transactions in the mempool. It handles raw encoded
hex containing transaction hashes and outputs a raw encoded hex of
bit flags. This makes the output size as small as possible while
speeding up the JSON encoding/decoding of the data.
JSON handling for the new wallet command getticketsvotebits has been
added. A common struct for voteBits data is now also used between
getticketvotebits and getticketsvotebits.
This bug was introduced with the fix for checkBlockForHidden votes. One of the
consistency checks fails if the template is uninitialized. The unitialized
pointer is now caught and the function will safely return.
This commit exports the ReadVarString and WriteVarString functions so
they are available for callers to use.
A variable length string is encoded as a variable length integer
containing the length of the string followed by the bytes that represent
the string itself.
The checkBlockForHiddenVotes function would corrupt block templates
by incorrectly inserting votes from other blocks. The function has
been rewritten and now correctly regenerates the block template with
the correct number of voters.
The first pass for the getCoinSupply command did not accurately reduce
the work and tax subsidies based on the number of voters. So the
coinsupply was slightly high due to blocks that had less than 5 voters
not being properly reduced to match the proper total block reward. Looks
like this reduces current coin supply count by roughly 1507 DCR
Framework handling the new listscripts JSON RPC command for wallet
has been added. This will allow wallet users to dump the complete list
of redeem scripts from their wallet.
getrawmempool has been modified to allow for the selection of specific
transaction types from the mempool. A new RPC call, existslivetickets,
has been added. This call takes a blob of ticket hashes and returns
a blob of bit flags specifying whether or not the tickets exist. This
allows for much faster getstakeinfo calls in the wallet.
This modifies the IP parsing code to work with IPv6 zone ids. This is
needed since the net.ParseIP function does not allow zone ids even
though net.Listen does.
This updates the findcheckpoint utility to work when there are not
already any checkpoints. This doesn't really matter for Bitcoin at the
current time, but if a new testnet is created it will not have any
checkpoints to start with and this change also means the utility can
work for alts.
While here, switch a couple of error prints to ensure they contain a
final newline.
The JSON framework has been modified to enable two new RPC calls,
existsliveticket and getstakeinfo. existsliveticket handling has
been added to the daemon RPC. It checks for the existence of a ticket
in the live ticket stake database given a hash.
Although the address indexer for the memory pool was a part of its
struct, it was not enabled in the daemon. The framework to enable it
by default has been completed and the mempool should now correctly
index transactions by address.
This RPC command should be able to hold us over until new db has been
added which will allow us to more quickly / less expensively track total
coin supply.
This is the current implementation in pseudo code:
1) Get tip block height
2) Iterate over all blocks, get block hash then get block header from
that hash.
3) If block 1, add block 1 subsidy as defined in chaincfg/params.go
4) If current block is a "reduction interval", then reduce base subsidy
accordingly
5) Calculate PoW, PoS and dev subsidy for current block
6) Add subsidies to running total (only PoW and dev if < Stake
Validation Height)
Corrected or added many comments.
Update test code to follow format go vet wants.
The code doesn't pass the checks 100% yet. That will come in a later
commit but these all seemed related so I'd rather get them in now.
The amount of fees required before a transaction is considered free has
been reduced. This also should allow smaller outputs by adjusting the dust
limits. At the same time, the code defining where a dust limit is has been
corrected. A new minimum threshold for a transaction to be included in the
wallet has also been added.
This modifies a few things to improve the getwork RPC call handling.
First, it corrects the calculation of the getworkDataLen constant to
work with any size block header. The current code calculated the
correct value for the current block header size, so the value of the
constant is not being changed, however the code was not accurate for an
arbitrary header size.
This is the case because the padding for the blake256 hash algorithm
requires a single 1 bit after the payload to be hashed in addition to
the 64 bits which encode the length of the message which is 65 bits. It
also requires the final bit of the padding prior to the encoded message
length to be a 1 and to fall on bit 448. This ensures the final block
is 64 bytes.
For a concrete example, the current code would incorrectly calculate
that a 184 block header only needs a getwork data length of 192, instead
of the 256 that is really required.
Second, because the block header size is constant and can't change while
the daemon is running, calculate the appropriate padding for the block
header size at init time rather than hard coding it directly in the get
work function. This also means new memory doesn't need to be allocated
for the constant bytes on every invocation as it was previously doing.
Finally, preallocate the full size of the getwork buffer instead of
using append which incurs the overhead of additional memory copies.
This is how it's done in upstream btcsuite and I'm not sure why it was
changed to be less efficient in Decred.
The address indexer would throw an error that would break indexing for a
block if it encountered an unparseable input or output script. Now it
skips the script and continues.
An off by one bug caused by inheritance from Bitcoin caused
multisignature transactions that were fully signed to be rejected
due to the number of stack items. The off-by-one bug has been fixed.