This commit updates the usage example as follows:
- Add a defer db.Close since the database should be closed after the
caller is done with it
- Correct the import path for the btcdb/sqlite3 package
- Add a db extension to the example database name
- Make the error handling and comments match the standard style
This commit attempts to clarify which functions in the Db interface may be
returning cached data that the InvalidateCache, InvalidateBlockCache, and
InvalidateTxCache functions are used to clear.
The Db interface is intended to work with block heights as opposed to
specific database ids which may or may not be the same as the block
height. This commits changes the function names to make that distinction
a little more clear.
This commit makes several changes to the operation tests as follows:
- Ensure the database is closed between each operational mode test as
otherwise the database is locked when trying to reopening it which
makes it unusable
- Make the insert tests error after a single failure since every test
afterwards is guaranteed to fail as well
- Remove some of the logging statements which cluttered up the failed test
prints making it harder to see why a given test failed
- Make a couple of the log messages more descriptive
The function is being added back in since the tests rely on it, but it is
marked as DEPRECATED since it really should not be a part of the public
generic db interface.
This commit changes MsgBlock to enforce a 1MB max payload per the spec.
Previously it was only limited to the max overall message size. While
here, also enforce max payloads per message type (instead of only the max
overall message payload) when writing messages.
This commit makes the examples a little more clear by providing complete
examples of the two different types of replies. These changes were
prompted by PaulCapes on IRC who pointed out the previous example was not
very clear.
ok jcv@
The functions for generating transaction and block hashes contained a few
error checks for conditions which could never fail without run-time
panics. This commit removes those superfluous checks and adds explanatory
comments.
The io.Writer.Write function always returns an error if the bytes written
is less than provided, so there is no reason to further check if the
payload length matches after a successful write.
This commit adds tests for the error paths when encoded and decoding
MsgHeaders. Also, while here modify the casing of the local vars to be
consistent.