blockchain.transaction.broadcast implementation #80

Merged
moodyjon merged 9 commits from blockchain_tx_rpc2 into master 2022-12-16 20:54:20 +01:00
moodyjon commented 2022-12-16 19:54:00 +01:00 (Migrated from github.com)

Fixes #79

So far I have tested this with an old transaction I found in the block explorer IIRC. The RPC goes to lbcd and it emits an error.

INFO[2022-12-16T12:32:16-06:00] JSONRPC server listening on 0.0.0.0:50001    
INFO[2022-12-16T12:32:16-06:00] listening on :2112 /metrics                  
INFO[2022-12-16T12:32:16-06:00] Server.Run() #### listening on [::]:50051    
INFO[2022-12-16T12:32:16-06:00] &server.Args{CmdType:0, Host:"0.0.0.0", Port:50051, DBPath:"/Users/swdev1/hub/scribe_db.1268171/lbry-rocksdb", Chain:(*string)(0x140001100e0), DaemonURL:(*url.URL)(0x140003f4090), DaemonCAPath:"/Users/swdev1/Library/Application Support/Lbcd/rpc.cert", EsHost:"http://localhost", EsPort:9200, PrometheusPort:2112, NotifierPort:18080, JSONRPCPort:50001, JSONRPCHTTPPort:50002, MaxSessions:10000, SessionTimeout:300, EsIndex:"claims", RefreshDelta:5, CacheTTL:5, PeerFile:"peers.txt", Banner:(*string)(0x14000110230), Country:"US", BlockingChannelIds:[]string{}, FilteringChannelIds:[]string{}, GenesisHash:"9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463", ServerVersion:"0.107.0", ProtocolMin:"0.54.0", ProtocolMax:"0.199.0", ServerDescription:"Herald", PaymentAddress:"", DonationAddress:"", DailyFee:"1.0", Debug:false, DisableEs:false, DisableLoadPeers:false, DisableStartPrometheus:false, DisableStartUDP:false, DisableWritePeers:false, DisableFederation:false, DisableRocksDBRefresh:false, DisableResolve:false, DisableBlockingAndFiltering:false, DisableStartNotifier:false, DisableStartJSONRPC:false} 
INFO[2022-12-16T12:32:16-06:00] HTTP JSONRPC server listening on :50002      
INFO[2022-12-16T12:32:16-06:00] open peers.txt: no such file or directory    
INFO[2022-12-16T12:32:19-06:00] Accepted: 127.0.0.1:63868                    
INFO[2022-12-16T12:32:19-06:00] from 127.0.0.1:63868 receive header          
INFO[2022-12-16T12:32:20-06:00] raw request: {"jsonrpc":"1.0", "method":"blockchain.transaction.broadcast", "params":["010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"], "id":60} 
INFO[2022-12-16T12:32:20-06:00] patched request: {"jsonrpc":"1.0","method":"blockchain.transaction.broadcast","params":[["010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"]],"id":60} 
INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive header: rpc.Request{ServiceMethod:"blockchain.transaction.broadcast", Seq:0x1, next:(*rpc.Request)(nil)} 
INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive body            
INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive body: &server.TransactionBroadcastReq{"010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"} 
INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive header          
INFO[2022-12-16T12:32:20-06:00] respond to 127.0.0.1:63868                   
INFO[2022-12-16T12:32:20-06:00] raw response: {"id":60,"result":null,"error":"-25: TX rejected: orphan transaction 81f07b828b1dbedb14653bc03fb1860443ea8636adf67f28079b7ffea3c7d780 references outputs of unknown or fully-spent transaction 1b3278a9a37186c6390f9e28aae5ec80d71726b7134c0219c5bc6ec6382fc268"} 
INFO[2022-12-16T12:32:20-06:00] patched response: {"jsonrpc":"2.0","id":60,"error":"-25: TX rejected: orphan transaction 81f07b828b1dbedb14653bc03fb1860443ea8636adf67f28079b7ffea3c7d780 references outputs of unknown or fully-spent transaction 1b3278a9a37186c6390f9e28aae5ec80d71726b7134c0219c5bc6ec6382fc268"} 
WARN[2022-12-16T12:32:21-06:00] error: read tcp4 127.0.0.1:50001->127.0.0.1:63868: read: connection reset by peer 
INFO[2022-12-16T12:32:21-06:00] session 127.0.0.1:63868 goroutine exit       
Fixes #79 So far I have tested this with an old transaction I found in the block explorer IIRC. The RPC goes to lbcd and it emits an error. ``` INFO[2022-12-16T12:32:16-06:00] JSONRPC server listening on 0.0.0.0:50001 INFO[2022-12-16T12:32:16-06:00] listening on :2112 /metrics INFO[2022-12-16T12:32:16-06:00] Server.Run() #### listening on [::]:50051 INFO[2022-12-16T12:32:16-06:00] &server.Args{CmdType:0, Host:"0.0.0.0", Port:50051, DBPath:"/Users/swdev1/hub/scribe_db.1268171/lbry-rocksdb", Chain:(*string)(0x140001100e0), DaemonURL:(*url.URL)(0x140003f4090), DaemonCAPath:"/Users/swdev1/Library/Application Support/Lbcd/rpc.cert", EsHost:"http://localhost", EsPort:9200, PrometheusPort:2112, NotifierPort:18080, JSONRPCPort:50001, JSONRPCHTTPPort:50002, MaxSessions:10000, SessionTimeout:300, EsIndex:"claims", RefreshDelta:5, CacheTTL:5, PeerFile:"peers.txt", Banner:(*string)(0x14000110230), Country:"US", BlockingChannelIds:[]string{}, FilteringChannelIds:[]string{}, GenesisHash:"9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463", ServerVersion:"0.107.0", ProtocolMin:"0.54.0", ProtocolMax:"0.199.0", ServerDescription:"Herald", PaymentAddress:"", DonationAddress:"", DailyFee:"1.0", Debug:false, DisableEs:false, DisableLoadPeers:false, DisableStartPrometheus:false, DisableStartUDP:false, DisableWritePeers:false, DisableFederation:false, DisableRocksDBRefresh:false, DisableResolve:false, DisableBlockingAndFiltering:false, DisableStartNotifier:false, DisableStartJSONRPC:false} INFO[2022-12-16T12:32:16-06:00] HTTP JSONRPC server listening on :50002 INFO[2022-12-16T12:32:16-06:00] open peers.txt: no such file or directory INFO[2022-12-16T12:32:19-06:00] Accepted: 127.0.0.1:63868 INFO[2022-12-16T12:32:19-06:00] from 127.0.0.1:63868 receive header INFO[2022-12-16T12:32:20-06:00] raw request: {"jsonrpc":"1.0", "method":"blockchain.transaction.broadcast", "params":["010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"], "id":60} INFO[2022-12-16T12:32:20-06:00] patched request: {"jsonrpc":"1.0","method":"blockchain.transaction.broadcast","params":[["010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"]],"id":60} INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive header: rpc.Request{ServiceMethod:"blockchain.transaction.broadcast", Seq:0x1, next:(*rpc.Request)(nil)} INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive body INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive body: &server.TransactionBroadcastReq{"010000000168c22f38c66ebcc519024c13b72617d780ece5aa289e0f39c68671a3a978321b010000006a47304402206be2c763070241e7245656fdd7e575122f9e1dd525da825688bd9d484b10ce9e0220472431d39777aa71eae85b52bda9da2ff7de467d8d6d178b75d446ebc729340d012102751aad773ac99a0092f83c5c1d770cd24406c16efaebc3531bc7bd6bc0f23e80ffffffff0280969800000000008db511404c4252592d444d4341526564466c61674c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ab7427f1b561428761dafaff36fd34d98433949578c448245da49369c18cfe83b713d34d6fb2d12765a406457729e5c4cbd3fe1df20c8bb7e9b378c8977a00ba6d7576a914fae6e7c0c10d286c32e6cdbfd356f341d5b5123588acdc83c451020000001976a914600988ac964238cdb05f8995702806a648051b0b88ac00000000"} INFO[2022-12-16T12:32:20-06:00] from 127.0.0.1:63868 receive header INFO[2022-12-16T12:32:20-06:00] respond to 127.0.0.1:63868 INFO[2022-12-16T12:32:20-06:00] raw response: {"id":60,"result":null,"error":"-25: TX rejected: orphan transaction 81f07b828b1dbedb14653bc03fb1860443ea8636adf67f28079b7ffea3c7d780 references outputs of unknown or fully-spent transaction 1b3278a9a37186c6390f9e28aae5ec80d71726b7134c0219c5bc6ec6382fc268"} INFO[2022-12-16T12:32:20-06:00] patched response: {"jsonrpc":"2.0","id":60,"error":"-25: TX rejected: orphan transaction 81f07b828b1dbedb14653bc03fb1860443ea8636adf67f28079b7ffea3c7d780 references outputs of unknown or fully-spent transaction 1b3278a9a37186c6390f9e28aae5ec80d71726b7134c0219c5bc6ec6382fc268"} WARN[2022-12-16T12:32:21-06:00] error: read tcp4 127.0.0.1:50001->127.0.0.1:63868: read: connection reset by peer INFO[2022-12-16T12:32:21-06:00] session 127.0.0.1:63868 goroutine exit ```
jeffreypicard (Migrated from github.com) approved these changes 2022-12-16 20:19:40 +01:00
jeffreypicard (Migrated from github.com) left a comment

Looks good.

Looks good.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/herald.go#80
No description provided.