Archive of the libbitcoin Slack #general channel.
$ ./bx fetch-history 134HfD2fdeBTohfx8YANxEpsYXsv5UoWyz
transfers
{
transfer
{
received
{
hash 97e06e49dfdd26c5a904670971ccf4c7fe7d9da53cb379bf9b442fc9427080b3
height 247683
index 1
}
spent
{
hash b7354b8b9cc9a856aedaa349cffa289ae9917771f4e06b2386636b3c073df1b5
height 247742
index 0
}
value 100000
}
}# The lower limit of address and spend indexing, defaults to 0. index_start_height = 0
m <enter>.====================== startup ======================= Using config file: "/home/user/.config/bn/bn.cfg" Database failed to start with error 'flush lock failure'. Please wait while restoring from most recent snapshot... restore::recover_snapshot(store) Database restore failed with error 'missing snapshot'. Node stopped successfully. ====================== shutdown ====================== Press <enter> to exit...
b <enter> but there is no recovery from where you are.====================== startup =======================
Using config file: "/home/user/.config/bn/bn.cfg"
Database failed to start with error 'flush lock failure'.
Please wait while restoring from most recent snapshot...
restore::recover_snapshot(store)
restore::open_file(header_head)
restore::open_file(header_body)
restore::open_file(input_head)
restore::open_file(input_body)
restore::open_file(output_head)
restore::open_file(output_body)
restore::open_file(point_head)
restore::open_file(point_body)
restore::open_file(ins_head)
Database restore failed with error 'no such file or directory'.
Node stopped successfully.
====================== shutdown ====================== bn -r (same but without starting up).network:: classes (session, channel, and protocol) into base behavior and derived [class]_peer and [class]_client, with existing specializations derived from the _peer side of the hierarchy.
I've just completed the separation, which also has a small impact on node::. I'm going to rename the network::p2p class to net because it will end up hosting both peer and client channels.
I'm not sure I'm totally excited about the source organization, but it's at least reasonably isolated and should be performant. I'm running now to verify.client classes are stubbed in. So time to start connecting! Next step is to add a session_input_client that uses the shared acceptor and a new [server] config section to accept incoming connections (e.g. port http://localhost:80) . Getting the channel_client 's established with a simple default protocol_client is the first step. That should allow connection by simply hitting the URL with a local browser. Then as before, it's down to isolated protocol implementations, and finally generalization across specific queries and other similar client-server protocols.session_inbound_client, opening a socket acceptor on the configured ip:port, attached to the port using http://localhost:42?hello=world, which spawned a socket and created a channel_client containing the socket, and hit debug points in attach_handshake.
[database] path = /mnt/blockchain/bitcoin [network] #threads = 4 #threads = 16 seed = cup.nop.lol:8333 [bitcoin] #checkpoint = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0 milestone = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0 [node] #threads = 16 #threads = 32 [server] inbound_connections = 0 bind = 0.0.0.0:80
[bitcoin] #checkpoint = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0 #milestone = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0(edited)
[database] path = /mnt/blockchain/bitcoin [network] seed = cup.nop.lol:8333 [bitcoin] checkpoint = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0 milestone = 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:0 [server] inbound_connections = 0
block_organized..... 316162 5197 block_validated..... 316163 5197 block_confirmed..... 316163 5197 block_organized..... 316163 5197 block_validated..... 316164 5197
read_line(terminator) methods). This allows for simplified and efficient parsing of http request line, headers, and bodies given single/multi-char terminators (such as "\r\n", " ", ":", "," and ";").write_line(string, terminator) also now added to the stream writers. Simplifies creation of the http response line, headers, and body. Also created request and response objects to encapsulate each. The request is passed via the notification mechanism (like p2p messages), along with the message (request body), which determines the notification type. This gives the handling protocol(s) direct access to the request while maintaining loose coupling and statelessness. The response object is constructed passed when a message is sent (response body).
http request/response only applies to html and json-rpc (Core compat) protocols, as well as the first message in a WebSocket upgrade. Others, including Stratum (vs/v2) and Electrum are just JSON over TCP - no http request/response. So those just skip the request/response serialization but are otherwise the same.response object, and refactored to share redundancy with request . Added comprehensive testing for all the parts, which mostly covers the hard part of http.byte_writer exposed by using its ::set_limit(...) in conjunction with ::peek_byte() , and also implemented an dynamical exponential buffer expansion for http header reads with an lower and upper bound configuration. This keeps the pre-channel read buffer small in cases unless larger is required.