We were counting the number of push ops instead of the number of non
push ops. Add tests that found this (checking tha the max operations
check fires).
Use this to test the pubkey paths in checksig which return btcec errors
which we don't define. all of the other active tests know the return
code we need.
Use it to reduce code dpulication in the bip16 case.
In addition we export it so that that a user could run:
for !done && err == nil {
done, err = s.Step()
}
err = s.CheckErrorCondition()
manually instead of having to run Execute().
Since we already have the specific username and password we want to strip
from errors, use a specific search string rather than a generic regular
expression. This is quite a bit more efficient than using regular
expressions and also has the benefit of being more accurate.
Also, rather than using the added overhead of fmt to convert the error to
a string, just call Error() directly on it to get the string.
Finally, instead of just stripping it, replace it with the literal
string "<username>:<password>" to avoid any possible confusion in the
error messages where it might otherwise appear the url was being
constructed incorrectly.
ok jcv@
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