* Added crypto project and decoupled BitcoinSLogger from NetworkElement
Decoupled BitcoinSLogger from Factory
Moved NetworkElement into crypto project
Moved Factory and BitcoinSUtil (renamed to BytesUtil) to crypto project
Moved MaskedToString to crypto project
Added BytesUtil to imports and cleaned up CryptoUtil.recoverPoint
Moved the rest of crypto stuff to the crypto project
Moved crypto tests to crypto-test project
* Added documentation for crypto project
* Add wallet creation time for rescans
* Fix docs
* Clean up and add test
* Remove account bday
* Fix compile issue and docs
* Add more chain handler tests
* Use Instant over Long, add docs
* Fix docs
* Re-enable NeutrinoNodeWithWalletTest with it disabled for mac
* Change to only Linux
* Only disable for CI runs
* Move IsCI to BitcoinSUtil
* Fix compile issue for earlier versions
* Fix syncing compact filters to not skip last filter
* Fix test to be compatible with new start state
* Use correct isCI
* Fix compile issue
* set CI env
* Implement Slick's multi database support via our DAOs
WIP2 work on chain project
WIP make JdbcProfieComponent so we have a common JdbcProfile
WIP2
Clean up a few things
WIP got CRUDAutoInc compiling
Get closer to everything compiling in the chain project
Begin moving database code into JdbcProfileComponent
WIP source compiling
Get dbCommonsTest/ test cases passing
Get rest of tests compiling and passing
* Rebase onto master, fix conflicts
* Run scalafmt
* Run scalafmt again
* Cleanup a few compiler warnings by adding type annotations to thigns
* Explicitly cast tables where they are needed in the wallet project where we need TableQuery for foreignkey / joins in slick
* Redo definition of 'table' to use the profile.api.TableQuery in scope
* Rename all *Table.scala files to *Db.scala
* First crack at address ben's code review
* Fix docs compile issue
* Fixed casting (#30)
* Fixed AppConfig casting
* Fixed TableQuery casting in DbManagement subtypes
* Fixed casts in DAOs relating to internal types
* Address nadav's code review, move JdbcProfileComponent into it's own file
* Remove unused listTables() method
Co-authored-by: Nadav Kohen <nadavk25@gmail.com>
* Change NodeCallbacks to Future[Unit] s
* Fix compile issue
* Change try to future
* Change Future.sucessful(()) to FutureUtil.unit
* Callback failure handling, callback docs
* Create functions for executing callbacks, make merkleblock a future
* Convert MerkleBuffersTest to BitcoinSAsyncTest
* Fix compiler errors
* Reorder UpdateBloomFilter tests so that txFromWalletP is a success for both calls and the other test does not wait on the promise to complete
* Add flyway migrations
* Make different project's migrations independent of each other
* Rework all AppConfig.initialize() to use migrations rather than what we were doing before
* TXO State migration
* Move to new file, drop old column
* Add block hash column
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
* Use the fact that network headers specify the number of bytes in the payload rather than just parsing from bytes.size, this should allow us to be more precise when parsing NetworkPayloads rather than _hoping_ that bytes.size does not land on pseudo-valid NetworkPayload. This hopefully resolves#782
* Add safety check around HeadersMessage.toString()
* Add invariant to NetworkMessage saying payloadSize in header must be the actual payload size
* Add a log at INFO level to indicate we are making progress while syncing
* Adjust sync log message to INFO in p2p code
* Fix off by one error
* Run scalafmt
* Remove isInitialized() check in sendMsg, which was causing a deadlock
* Enable akka logging to help debug NeutrinoNodeTest
* Revert to bypassing the isInitialized() check in sendMsg()
* Run scalafmt again
* Remove AKKA_CONFIG that was preventing sane logging for akka, move db-commons reference.conf to testkit so we can control testkit applications, and then rename app/server/.../application.conf to reference.conf like good libraries should do
* Update contributing.md
* update a few more links inside of contributing.md
* Run scalafmt
* Bump Scala versions
Support Scala 2.12.9
and 2.13.0.
To make this easier, we delete the `scripts` project. Everything
that was in here was covered by content on the website. We also
delete the `doc` folder, as that was a remnant from when `scripts`
was called `doc`.
* Crib uPickle akka-http support while we wait for publish
* Fix compiler warnings
* Add note on test logging to contribution guide
* Reduce duplication in Blockchain implementation
* Use Scala 2.12 for website
* Introduce compat package object for collections converters
* Fix Either compiler warnings
* Add sync-chain and create-wallet docs from deleted scripts
* Fix rebase goofup
* Split app loggers into their corresponding modules
This avoids a bunch of places with awkward implicit resolution.
We also make sure that all logging in node, chain and wallet
happens with the app loggers, and not BitcoinSLogger
* Tune test logging level to WARN
* Start refactoring BroadcastTransactionTest to use new SpvNodeFundedWalletBitcoind fixture
* Double timeout to 10.seconds on spv node disconnect
* Attempt to bump disconnect even more
* Add more logging around starting and stoping spv node to try and debug failures with fixtures on test suites
* move starting of spv node into one place in the fixtures -- createSpvNode() --, also look at ordering of destruction to make sure that the spv node is stopped/destroyed BEFORE bitcoind is stopped/destroyed. If the inverse order happens, our spv node won't receive a response from bitcoind and will hang waiting for the Tcp connection to close gracefully
* Try switching from to to get CI to pass
* Add more logging and throws to try and debug failures on ci
* Add logging in the case we send a close command and peer isn't defined
* Match on Tcp.Connect on default receive in P2PClient
* Make SpvNode.disconnect() check to see if we are connected before attempting to disconnect
* Add more logging in fixtures, change behavior of SpvNode.disconnect() to not throw if we are already disconnected
* Switch to preferred way of terminating actor system in tests
* Make PeerMessageSender.sendMsg() return a , make sure a message is not sent to P2PClient until we are fully intialized
* Switch p2p logging to DEBUG
* Complete disconnect promise on peer message recv in the case where we didn't have a peer to begin with
* Make SpvNodeTest more robust, fix bug for when we send 'sendheaders' message. We shouldn't do this until our peer has sent us a verack
* Only send 'sendheaders' message to our peer after we receive a 'sendheaders' message from our peer. Hopefully this solves async issues where we were sending 'sendheaders' before our handshake was fully completed with our peer which means we wouldn't get headers sent to us
* Cleanup pt1
* Start the process of refactoring our ChainHandler to be able to avoid database calls on TipValidation
WIP: Begin explicity passing state back and forth in return types of PeerMessageReceiver, P2PClient, , DataMessageHandler. This commit also implements the ability to keep our blockchain completely in memory. Previously when we were updating the tip of the chain, we had to make a database read to figure out what the best tips are. This is suboptimal for performance because a database read needs to be done for every block header we see, now we just keep the chain in memory
Fix bug in DataMessageHandler that pre-emptively sent a getheadersmsg to our peer. Make 'chainApiF' internal to our spvNode (not a parameter). This forces the chainApi to be created from disk everytime a new SpvNode is spun up. This keeps us in sync with the blockchain at disk at the cost of disk access and less modularity of SpvNode
Address torkel code review
Fix rebase issues
Address code review
Address nadav code review
* Rebase onto master, fix api changes
* Add functionality for updating SPV node bloom filter
* Add SPV node shutdown to exit hook
* Clean up traits/case classes
* Change fixture in WalletBloomTest
* Fix logging bug in TransactionProcessing
* Add MerkleBuffers
In this commit we add MerkleBuffers, which is an object
that lets us aggreagate merkleblocks with their corresponding
transactions before sending them out. This is global, mutable
state (bad!) but it's a working solution for now;
* Use TestAsyncUtil
* Add MerkleBuffers test
* Send getdata if receiving single header
* Change awaitSync to use block count
* Fix UpdateBloomFilterTest
* Add more logging of chain/headers validation
* Send getdata for all blocks
* Nits: Scaladocs, comments toString
* Add logging to data directory
In this commit we add the ability for the node, chain
and wallet projects (+ the server) to log to the users
data directory instead of whatever directory the
binaries was launched from. This is inherently a bit
more complicated than our previous setup, because
we need to read the user directory before we can create
loggers. As a result of this, some files/methods were
moved around, so the relevant app config could be
found in scope.
We also introduce several logging categories that can be
tuned individually through user configuration. These logggers
are exposed both as traits that give a field `logger`, or
as methods that return the required logger.
* Add datadir configuration to AppConfig
In this commit we add support for AppConfig to pick up
the data directory configuration file. We also add
a section to the contributing guide on how to tune
logging levels.
* Pass data directories explicitly for configuration
* This PR is attempting to remove the publishing errors when publish
locally many of which are incorrectly linked things in scaladocs which
there are some differences in formatting. Hopefully this removes alot
if not all of the "link not found for ..." warning messages that show
up.
* Add functionality for broadcasting TXs to node
In this commit we add functionality and tests
for broadcasting a TX from our node. To accomplish
this we introduce a table over broadcastable TXs
that's added to when the externally facing method
broadcastTransaction(tx) withing SpvNode is called.
We send out a inv message for the TX we just added,
and upon receiving a getdata message we search in
the previously mentioned table for entries where
the hashes match up.
* Broadcast TX from server to SPV node
* Perform assertions on the balance of bitcoind after sending a TX
* Remove typeclass from broadcast TX
* Refactor withFundedWalletAndBitcoind
* Match on BitcoindExecption instead of throwable
* Clean up broadcast functionality after code review
* Cleanup
In this commit we cleanup a few Scaladocs and change some
trait/impl pairs into just a case class.
* Node cleanup
In this commit we
1) Rename Client to P2PClient. Client is a very generic name.
2) Clean up some Scaladocs
3) Remove some unecessary objects/traits/classes and replace them
with case classes
4) Add trace logging of bytes received in P2PClient
* Attempt to sync with sendheaders
Fix sync with headers by generating one block in regtest to get out of IBD
Fix comment
Add more comments
Add missing actor system import
more clean up
* refactor test case to avoid sleeping the thread
* Log messages more granularely in node
* Add pong message
* Rework P2P service identifier
The old implementation didn't catch the notion
that service identifiers was a bit field where
multiple services could be set at the same time.
* Make Peer take InetSocketAddress
Previously it took NetworkIpAddress.
This doesn't make any sense, as we
need to know the services bitfield
to construct a NetworkIpAddress.
* Clean up logs and toString methods
* Clean up node README and main method
* Make all networks final case objects
* Skip publishing of wallet, node and chain
* Clean up logging of node and chain modules
* Add logging of max height in SpvNodeMain
* Clean up Scaladoc and toStrings
* Add logging configuration as symlinks in node
We'll have to figure out a more stable solution to
configure logging for the SPV node, but for the time
being this is an acceptable solution.
* Fix 2.11 compiler error
* Add getAddressInfo to Wallet API
* Add Bloom filter and event callbacks to SPV node
* Move wallet test trait to testkit
* Test for connecting SPV node with wallet
* Tune logging in SPV node
* Clean up BloomFilter
* Proper toString in inventory and inventorymessage
* Actually pass in callbacks to SPV node
* Fix rebase screwup and partially respond to code review
* Default to file based databases in tests
This is due to issues with deadlocks with
in-memory based databases. We need DBs
to stay alive between connections, but
not across tests.
In DB intensive chain validation tests we
use in-memory databases instead. This
seems like a reasonable tradeoff between
simplicity and speed.
* Make SpvNodeCallbacks contain sequence of functions within
* Make Bloom filter non-optional in SpvNode
* Reshuffle package location of P2P messages
Previously the companion objects for P2P messages
and the actual messages were in different pacakges.
This made them more awkward to use than necessary.
We also clean up some Scaladocs in this commit.
* Move all P2P messages to core