Commit Graph

182 Commits

Author SHA1 Message Date
kindknow
7c3dbf96ca
chore: remove redundant words in comment (#5826)
Signed-off-by: kindknow <iturf@sina.com>
2024-12-31 11:09:52 -06:00
Chris Stewart
54ef1bd0a5
chain: Add invariant that we have at least 1 header in Blockchain (#5810)
* chain: Add invariant that we have at least 1 header in Blockchain

* Add invariant to check heights in BlockHeaderDAO.getBlockchainFrom()
2024-12-13 13:07:35 -06:00
Chris Stewart
65e67287f8
2024 10 21 Replace Future.sequence() usage with Future.traverse() (#5732)
* Use more Future.traverse()

* More Future.traverse()
2024-10-22 16:57:23 -05:00
Chris Stewart
84aba7e349
Remove test case specific fixture setup in chainTest, revert to just using test suite specific fixtures (#5712) 2024-10-15 14:07:30 -05:00
Chris Stewart
ac7739444f
Add -Xsource:3 to chain/ (#5587)
* Add -Xsource:3 to chain/

* -quickfix chainTest
2024-05-11 09:49:01 -05:00
Scala Steward
afddf73c48
Update scalafmt-core to 3.8.1 (#5501)
* Update scalafmt-core to 3.8.1

* Update .scalafmt.conf settings to be factory default settings

* Fix typo

* scalafmt

* Empty commit to re-run CI

* Revert some scalafmt back to original scalafmt.conf

---------

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2024-04-20 19:55:49 -05:00
Chris Stewart
376872eb3e
Remove different versions of Blockchain.scala now that we don't support scalac 2.12 (#5519) 2024-04-12 09:53:30 -05:00
Chris Stewart
177542a13c
Remove grizzled.sl4fj was its no longer maintained (#5482) 2024-03-18 16:48:58 -05:00
Chris Stewart
c407c2e874
2024 02 29 cleanup logback files (#5441)
* Remove logback settings for things that don't exist anymore

* Consolidate slick logging

* Clean up chain logs

* Conslidate wallet logging

* Consolidate node logging

* Remove comments in logback files
2024-02-29 16:55:43 -06:00
Chris Stewart
e4fbfe73e6
2024 02 16 fix get filter sync marker from stop block header bug (#5401)
* Fix bug in getFilterSyncMarkerFromStopBlockHeader where we were previously querying for children rather than the block hashes at the given height for building the FilterSyncMarker for getcfilter request. Also introduce delay in sending getcfheader because of https://github.com/bitcoin/bitcoin/issues/27085

* Only fallback to reorg scenario if we find no headers at height + 1

* Remove the best filter's block header from the candidate headers in reorg scenarios
2024-02-17 06:26:55 -06:00
Chris Stewart
748121fe8a
2023 01 06 small chainhandler bug fixes (#5345)
* Get ChainApi.nextBlockHeaderBatchRange() tests passing

* Get all tests passing in chainTest/test

* Get all tests passing

* Add BlockHeaderDAO.getBlockchainFrom(header,startHeight), use it for filter marker computation

* Add carve out for IBD when syncing filter headers to avoid loading entire block header chain into memory

* Cleanup

* Fix inconsistencies between ChainApi.{nextBlockHeaderBatchRange, nextFilterHeaderBatchRange}
2024-01-07 12:16:36 -06:00
Chris Stewart
3a927edee1
Fix bug when requesting FilterSyncMarker for filter headers (#5344)
* Fix bug when requesting FilterSyncMarker for filter headers outside of our in memory blockchain's range

* Rework buildNHeaders to be faster, move it to ChainUnitTest
2024-01-06 09:59:26 -06:00
Chris Stewart
5e81ec5ed2
Add ChainApi.getBestChainTips() (#5338)
* Add ChainApi.getBestChainTips()

* Implement BitcoindRpcClient.getBestChainTips()

* Revert NodeTestUtil

* Use ChainApi.getBestChainTips() throughout codebase rather than blockHeaderDAO.getBestChainTips()
2023-12-31 16:54:40 -06:00
Chris Stewart
06dfd9cea4
Rework randomPeerWithServices() to be inside of NodeState (#5331)
* Rework randomPeerWithServices() to be inside of NodeState, try to move more state into NodeState

* Don't try to sync from peer waitingForDisconnection

* Add PeerWithServices, keep track of ServiceIdentifier in PeerManager and NodeState

* Try to make reorg test more reliable

* Empty commit to run CI
2023-12-29 14:47:29 -06:00
Chris Stewart
f1775c46d3
Simplify ChainHandler.nextFilterHeaderBatchRange() (#5336)
Get implementation working for walking backwards to find best filter associated with our stopBlockHeaderDb
2023-12-29 10:20:24 -06:00
Chris Stewart
af361167a4
Refactor ChainHandler.findNextHeader() to only take 1 blockchain (#5335)
* Refactor ChainHandler.findNextHeader() to only take 1 blockchain as a parameter

* Empty commit to re-run CI
2023-12-28 17:32:28 -06:00
Chris Stewart
d983a1bac4
2023 12 24 Make filter headers / filters sync work with block header reorgs (#5333)
* Rework ChainApi.nextBlockHeaderBatchRange() to take stopHash parameter, get chainTest/test passing

* WIP: Refactor ChainApi.nextFilterHeaderBatchRange()

* Finish ChainApi.nextFilterHeaderBatchRange() refactor, get all tests passing except reorg related tests in nodeTest

* Get NeutrinoNodeTest reorg test case working

* Improve flaky test

* Cleanup

* Switch sync check to bitcoinds(1)

* Empty commit to run CI

* Implement batchSize tests in ChainHandlerTest

* Rework ChainHandlerTest to not assume we have the genesis filter header / filter inserted into the database already

* Cleanup println

* Fix bug with nextFilterHeaderBatchRange() wrt to startHeightOpt parameter

* Fix off by one bug with compact filter sync

* Add check for connectionCount

* Add longer timeout

* scalafmt
2023-12-28 10:43:01 -06:00
Chris Stewart
16fb5d2dad
2023 12 19 compiler opts (#5330)
* Enable more compiler options

* enable -Xlint:valpattern, fix bug with out Test / scalacOptions were set with incorrect source code compiler flags

* Enable -Xlint:eta-sam

* Fix cryptoTestJVM

* Fix cryptoTestJS/test

* Fix asyncUtilTest

* Fix asyncUtilTest
2023-12-20 05:42:01 -06:00
Chris Stewart
3e6ff52194
2023 09 27 issue 5139 (#5247)
* Add test case for reorg on bitcoin network for NeutrinoNodeTest

* Get unit tests passing

* Refactor findNextHeader() to not take an Option[BlockHeaderDb], not it just takes BlockHeaderDb

* Explicity return None in the case where we don't need sync filter headers

* Fix off by one bug when starting filter header sync
2023-09-29 07:35:26 -05:00
Chris Stewart
0e2fddcc57
Optimize bestFilterHeaderHeightQuery (#5223) 2023-09-05 09:45:56 -05:00
Chris Stewart
8ab9718a48
Reduce best filter height sql query costliness by using a cheap check (#5206) 2023-08-25 14:25:41 -05:00
Chris Stewart
4a344f0187
Fix bug in ChainApi.processFilterHeaders() (#5157)
* Fix bug in ChainApi.processFilterHeaders()

* Reduce log level for case where we are processing filter headers we have already seen before
2023-07-19 17:09:04 -05:00
Chris Stewart
13e5e6501c
Fix bug where compact filters weren't being processed in order of block height during IBD (#5041)
* Fix bug where compact filters weren't being processed in order of block height during IBD

* Use sorted compact filter messages in chainApi.processFilters()
2023-04-10 16:42:48 -05:00
Chris Stewart
dc0e3645d0
2023 03 24 is tip stale (#5024)
* WIP

* Fix test

* Add more tests for stale header

* remove uncessary comments
2023-03-26 08:20:27 -05:00
Chris Stewart
875a67a73c
2023 03 03 rm DataMessageHandler filter params (#5009)
* Remove DataMessageHandler filter params, tests not passing

* Adjust logging levels

* WIP

* Get tests passing

* Cleanup

* Fix logging level

* Invert isSynced flag

* Rework BaseBlockchain.toString

* Fix BlockchainTest

* Fix syncing of compact filters when walletCreationTime is passed into dmh

* Cleanup
2023-03-14 11:45:21 -05:00
Chris Stewart
de0e892b3e
2023 02 27 Fix bug where duplicate filters caused node not to sync (#5008)
* WIP

* Modify DataMessageHandler to use Set for filter batch, fix test case

* revert log level

* Remove duplicate filters test

* Re-add test to make sure we don't throw an exception when processing a filter we've seen before

* Empty commit to re-run CI

* Empty commit to re-run CI

* Empty commit to re-run CI

* Fix NeutrinoNodeTest

* Empty commit to re-run CI

* Empty commit to re-run CI
2023-03-02 06:46:08 -06:00
Chris Stewart
7f08458a55
Check compact filter headers if we have already stored them in the database (#5003)
* Check compact filter headers if we have already stored them in the database

* revert node-test
2023-02-25 12:55:51 -06:00
Chris Stewart
c5983730bb
2023 01 10 refactor peermanager (#4950)
* Make PeerManager.finder private

* Make PeerManager.supervisor private

* Write unit test to see if default peer is added to PeerManager

* Use withNeutrinoNodeUnstarted fixture

* Get unit tests passing

* Add println to try and debug CI

* Add more println

* more println

* Adjust nodeTest / parallelExecution = false

* Try to make error logged to figure out why failure is happening on CI

* Adjust log level to ERROR

* Add catch to try and log failure messages

* Add log for sending messages to peers

* Try to increase threadpool size to see if we are deadlocking

* Add more logs

* Add another log to detect where failure is

* Try using Actor.tell() with explicit ActorRef.noSender

* Very detailed logging

* Remove duplicate method from rebase

* Revert things

* Revert build.sbt

* Empty commit

* Bump timeout

* Empty commit to run CI

* Revert more files
2023-01-27 10:43:50 -06:00
Chris Stewart
dd08dedb41
2023 01 24 small changes from pr 4950 (#4958)
* Pull things over from 4950 that shouldn't cause issues to reduce size of 4950

* Reduce timeout for processing a batch of messages from 1000 seconds -> 60 seconds

* scalafmt

* Empty commit
2023-01-25 08:31:57 -06:00
Chris Stewart
dbd54ca55f
2022 11 11 sbt 1.8.0 (#4883)
* upgrade to scala 2.13.10

* Remove 2.13.8 from CI

* Try upgrading to sbt 1.8.0-RC1 to see if build works on CI

* Try to update scoverage to 2.0.6

* Upgrade sbt native packager to 1.9.11

* Upgrade to sbt 1.8.0
2022-11-16 12:05:59 -06:00
Chris Stewart
bcddb015ae
2022 09 12 Filter header and filter websocket events (#4777)
* implement chain callbacks for compact filter headers / compact filters

* Wire it up through the websocket

* Fix type for compactfilterprocessed

* Fix bug to write json rather than write a string
2022-09-15 20:05:54 -05:00
Shreyansh
2cae3f803d
Fix infinite invalid header loop (#4667)
* fix infinite invalid header loop

* Adjust log levels to WARN

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-08-26 09:43:07 -05:00
benthecarman
02f525fd39
Make CRUDAction types more strict (#4657) 2022-08-24 06:15:24 -05:00
Chris Stewart
86463231d6
2022 08 18 Add configuration to only emit websocket events when IBD is done (#4627)
* Implement isinitialblockdownload flag in databaes

* Change to IsInitialBlockDownload to be less confusing

* Fix missing refactors, add ChainApi.isIBD()

* Implement logic for ChainApi.isIBD(), add configuration flag to toggle whether to emit websocket events while IBD is ongoing or not, add isinitialblockdownload field to getinfo endpoint

* Remove confusing ChainApi.isIBD() that didn't accurately account for the case where IBD wasn't set in the database

* Fix bug around emitting the websocket events

* Add some documentation
2022-08-22 10:09:00 -05:00
Chris Stewart
27120a2bb9
Add InvalidBlockHeader ChainException (#4635) 2022-08-21 12:33:18 -05:00
Chris Stewart
d0dadfa423
2022 08 11 issue 4600 and only emit syncing ws event when we are actually syncing (#4604)
* Check if bitcoind is syncing before running scheduled job to poll bitcoind

* Set syncing flag to true if initialblockdownload is true

* Implement logic so we only emit websocket events when state is changed, rather than everytime we poll bitcoind

* Implement logic to only emit websocket event when descriptor flag changes rather than when it is set
2022-08-12 14:34:03 -05:00
GreyMcCarthy
c34b0de886
removed logger parameter from where it's used with callbacks (#4598)
* removed logger parameter from where it's used with callbacks

* removed logger from onTXRecived... and onBlockRecived...

* removed unused imports

* removed logger from walletCallbacks
2022-08-12 12:09:58 -05:00
benthecarman
b04a34ad02
Use FutureUtil.makeAsync where we are attmepting to create async Futures (#4583) 2022-08-08 15:22:32 -05:00
Chris Stewart
5c9092889b
Add abillity to clear callbacks (#4512)
Fix missing clearCallbacks()

Add some tests

Remove uncessary code from test
2022-07-17 09:10:57 -05:00
Chris Stewart
d1375a589e
2022 07 12 server startup cleanup (#4501)
* Remove handleMissingSpendingInfoDb

* Remove chainwork recalc

* Fix compile error and move torcallbacks in to buildNeutrinoCallbacks()

* Fix compile pt2
2022-07-13 14:22:19 -05:00
rorp
e90e372e54
Add sync JSON field to the getinfo endpoint output (#4452)
* Add `sync` JSON field to the `getinfo` endpoint output

* improve test coverage

* update docs

* rename sync flag

* WebSocket notifications

* fix unit tests

* fix unit tests

* increase test timout
2022-07-12 14:41:43 -05:00
Chris Stewart
1b169d8fa0
Implement torstarted websocket callback (#4476)
* Implement tor started websocket callback

* Implement tor callbacks when tor is provided
2022-07-11 10:26:30 -05:00
Chris Stewart
d46b4a6c91
Make logging to file async, remove neverBlock configuration so that we are guaranteed to capture logs (#4305) 2022-05-01 06:45:33 -05:00
rorp
48189d5c1d
Make CRUD.run and CRUD.runVec transactional (#4059)
* Make `CRUD.run` and `CRUD.runVec` transactional

* remove explicit `transactionally` calls
2022-02-07 17:42:48 -06:00
benthecarman
142612f034
Make newConfigOfType use Vector[Config] (#4039) 2022-02-04 06:14:16 -06:00
Chris Stewart
e802254a20
2022 01 24 rm appconfig varargs (#4011)
* Get things compiling

* Get tests passing

* Fix docs
2022-01-25 07:25:05 -06:00
Chris Stewart
7ee1f0f406
Implement batching of database calls for our chain callback (#4003) 2022-01-23 07:39:10 -06:00
Chris Stewart
ee0d62c5b8
2022 01 14 DLCDataManagement refactor (#3982)
* WIP

* Finish refactor, get unit tests working

* Remove log
2022-01-18 08:12:27 -06:00
rorp
4b07629d56
Add getmediantimepast RPC call (#3921)
* Add `getmediantimepast` RPC call

* update docs

* respond to the PR comments
2021-12-22 16:15:30 -06:00
rorp
fa45c74c36
Improve filter header verification (#3566)
* Improve filter header verification

* unit test
2021-08-18 06:57:01 -05:00