-
Notifications
You must be signed in to change notification settings - Fork 19
Expand peer registry usage and improve reputation system for catchup #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 54 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
3798bb8
Enable support for viewing peer registry details
galt-tr f7bd1cb
Small fixes
galt-tr 0ed2490
Add ban manager to registry
galt-tr a2d816e
Refactor blockvalidation catchup to use the peer registry
galt-tr a144ee8
Add caching
galt-tr 4bcd032
Refactor a bit
galt-tr 172c4f8
Add subtree stuff
galt-tr bf5ca17
Fix peer ID mapping
galt-tr aec56db
Fix gen
galt-tr be4a23b
Turn off subtree reputation
galt-tr a38866e
Add catchup indicator
galt-tr 0897929
Finish rebase
galt-tr 8f6a20f
Move to constant peer IDs
galt-tr 9d5fcae
Stable peers
galt-tr c5bc30a
Fix reputation system
galt-tr 51d3d83
Properly catch sync failures
galt-tr e425d33
Updates
galt-tr af393aa
Fix table
galt-tr e5f422a
Fix catchup logic
galt-tr 2706653
Change log
galt-tr 019e679
Fix lint errors
galt-tr 7909858
Fix format
galt-tr 6db4722
Fix p2p tests
galt-tr 692d95a
Fix get blocks test
galt-tr 2f396ea
Don't reset success counter
galt-tr aa24b18
Move peer registry endpoint to asset service
galt-tr c0699f7
Fix URL construction
galt-tr bf2567a
Add positive reputation for subtrees
galt-tr 3f80586
Fix peers page for container deployments
oskarszoon 5598961
Fix catchup status for compiled svelte
oskarszoon 33e52f8
Prevent secret mining check from triggering during catchup
oskarszoon 3445afb
Improve catchup state block
oskarszoon de8c821
Switch asset to use hardened grpc connections to p2p and blockvalidation
oskarszoon 047da04
Implement client name
galt-tr f635dff
Change some rendering for catchup
galt-tr 4a9d27c
Rename
galt-tr 1eb4e5d
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 50c305f
Add tsts
galt-tr 68b508b
Fix linters
galt-tr 5e19bb5
Fix tests
galt-tr 116d6eb
Fix another test
galt-tr 6a14fbd
Address feedback
galt-tr a619618
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon f6c1bf3
Remove temporary doc, will be integrated into main docs seperately
oskarszoon 3778014
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon f6602c7
make gen with latest protoc
oskarszoon bb76a1d
Fix file naming for new files
oskarszoon e137f00
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon ebf8e22
Prevent local issues being reported as peer issue
oskarszoon 48ff56b
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon bd3960d
Fix race test
galt-tr 34e7f01
Fix claude feedback
galt-tr 50e3c57
Made creation of p2p client a singleton
icellan 3f8cd74
Cleaned up peer_selection
icellan 28bb439
Add locking around difficulty setting
oskarszoon 7d4e017
Merge branch 'main' into peerRegistryViewer
galt-tr 235e034
Add another test
galt-tr aa41978
Fix regex for test
galt-tr 374c6d1
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 7825fd6
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 73b5d15
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon fa7284b
Update go-subtree to latest with reduced buffer sizes
oskarszoon 74ec593
SubtreeMeta/SubtreeNode/SubtreeData was renamed in go-subtree package
oskarszoon c7434a9
Fix lint
oskarszoon f65a1c1
Remove P2P Health mechanism in favor of using only reputation
oskarszoon 347fd44
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 52f721b
Fix lint
oskarszoon a9def97
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon d6e820b
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon f9c87f2
Merge branch 'main' into peerRegistryViewer
galt-tr 57b7c79
Error return for catchup
galt-tr 5d56152
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 461ed92
Merge branch 'main' into peerRegistryViewer
galt-tr 225e7a7
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 865e541
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon f1863f4
Cleanup and updates on interfaces and code conventions
icellan cd4e972
Refactored peerID and baseURL to be passed into functions in the same…
icellan 2c34d3d
Merge branch 'main' into peerRegistryViewer
icellan 41d32ca
Cleanup and updates on interfaces and code conventions
icellan 04edee7
Refactored peerID and baseURL to be passed into functions in the same…
icellan 7065104
Merge branch 'dylan/peerRegistryViewer' of github.com:icellan/teranod…
icellan 436aac5
Fixed order of peerID and baseURL in mock
icellan ad3c247
Fixed passing in p2pClient to asset repository
icellan 2447097
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 4569e54
Merge branch 'main' of https://github.com/bsv-blockchain/teranode int…
oskarszoon 63ecf51
Advertise as a full node in legacy service when we have the persister
oskarszoon 5fa2002
Decrease validation/catchup buffers and channel to improve catchup re…
oskarszoon a1687d3
More catchup improvements
oskarszoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package httpimpl | ||
|
|
||
| import ( | ||
| "context" | ||
| "net/http" | ||
| "time" | ||
|
|
||
| "github.com/bsv-blockchain/teranode/services/blockvalidation/blockvalidation_api" | ||
| "github.com/labstack/echo/v4" | ||
| ) | ||
|
|
||
| // GetCatchupStatus returns the current catchup status from the BlockValidation service | ||
| func (h *HTTP) GetCatchupStatus(c echo.Context) error { | ||
| ctx, cancel := context.WithTimeout(c.Request().Context(), 5*time.Second) | ||
| defer cancel() | ||
|
|
||
| // Initialize persistent gRPC clients if not already done | ||
| h.initGRPCClients(ctx) | ||
|
|
||
| // Check if BlockValidation client connection is available | ||
| if h.blockvalClientConn == nil { | ||
| h.logger.Errorf("[GetCatchupStatus] BlockValidation gRPC client not available: %v", h.blockvalClientInitErr) | ||
| return c.JSON(http.StatusServiceUnavailable, map[string]interface{}{ | ||
| "error": "BlockValidation service not available", | ||
| "is_catching_up": false, | ||
| }) | ||
| } | ||
|
|
||
| // Create BlockValidation API client from persistent connection | ||
| client := blockvalidation_api.NewBlockValidationAPIClient(h.blockvalClientConn) | ||
| resp, err := client.GetCatchupStatus(ctx, &blockvalidation_api.EmptyMessage{}) | ||
| if err != nil { | ||
| h.logger.Errorf("[GetCatchupStatus] Failed to get catchup status: %v", err) | ||
| return c.JSON(http.StatusInternalServerError, map[string]interface{}{ | ||
| "error": "Failed to get catchup status", | ||
| "is_catching_up": false, | ||
| }) | ||
| } | ||
|
|
||
| // Convert gRPC response to JSON | ||
| jsonResp := map[string]interface{}{ | ||
| "is_catching_up": resp.IsCatchingUp, | ||
| "peer_id": resp.PeerId, | ||
| "peer_url": resp.PeerUrl, | ||
| "target_block_hash": resp.TargetBlockHash, | ||
| "target_block_height": resp.TargetBlockHeight, | ||
| "current_height": resp.CurrentHeight, | ||
| "total_blocks": resp.TotalBlocks, | ||
| "blocks_fetched": resp.BlocksFetched, | ||
| "blocks_validated": resp.BlocksValidated, | ||
| "start_time": resp.StartTime, | ||
| "duration_ms": resp.DurationMs, | ||
| "fork_depth": resp.ForkDepth, | ||
| "common_ancestor_hash": resp.CommonAncestorHash, | ||
| "common_ancestor_height": resp.CommonAncestorHeight, | ||
| } | ||
|
|
||
| // Add previous attempt if available | ||
| if resp.PreviousAttempt != nil { | ||
| jsonResp["previous_attempt"] = map[string]interface{}{ | ||
| "peer_id": resp.PreviousAttempt.PeerId, | ||
| "peer_url": resp.PreviousAttempt.PeerUrl, | ||
| "target_block_hash": resp.PreviousAttempt.TargetBlockHash, | ||
| "target_block_height": resp.PreviousAttempt.TargetBlockHeight, | ||
| "error_message": resp.PreviousAttempt.ErrorMessage, | ||
| "error_type": resp.PreviousAttempt.ErrorType, | ||
| "attempt_time": resp.PreviousAttempt.AttemptTime, | ||
| "duration_ms": resp.PreviousAttempt.DurationMs, | ||
| "blocks_validated": resp.PreviousAttempt.BlocksValidated, | ||
| } | ||
| } | ||
|
|
||
| return c.JSON(http.StatusOK, jsonResp) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.