14 Commits

Author SHA1 Message Date
tomFlowee 4fe9d69e7b Use more specific define-guards 2024-01-24 21:03:58 +01:00
tomFlowee bc47a700a4 Refactor; wrap BufferPool in shared_ptr
As we moved most of the creation of a BufferPool to be via the
Streaming::pool() method, which uses a thread-local, it makes sense
to start cleaning up the design and make it more modern C++.
The above mentioned method would return a reference and you'd see
loads of places use `auto &pool =` which is less than ideal.

As the number of places where we actually instantiate a BufferPool
goes down, the usage of some sort of smart pointer makes more sense.

This now makes all APIs use BufferPool be wrapped in a shared_ptr.
2023-12-21 15:23:23 +01:00
tomFlowee c6720314ff API fix 2022-08-13 23:42:40 +02:00
tomFlowee d797b1bf50 Minor additions of helper methods.
Tested in the upcoming unit test.
2021-03-24 21:00:25 +01:00
TomZ c7aee5efa9 Prevent incorrect usage and double delete
This only applies to the case where the MessageBuilder was used without
an external pool, but lets make sure the code is robust for even that
case.
2020-09-02 13:54:45 +02:00
TomZ 33c6758ea5 Add some API docs. 2020-05-23 14:03:42 +02:00
TomZ 8b365263de cleanup 2020-03-29 12:55:12 +02:00
TomZ 00d4905db2 Provide another convenience method for making messages
THe builder now allows you to create a message with the
serviceId, the messageId and the requestId pre-set.

This benefits code that just takes the output from the
builder and calls 'send' on it immediately saving several
lines of code.
2020-02-19 16:55:46 +01:00
TomZ 3383d1e1dc Add method MessageBuilder::reply()
This is an overload of message() specifically meant to build
replies to incoming messages.
The behaviour changed here is that incoming messages with
headers other than "RequestId" now get copied to the outgoing
message by default.
2019-06-24 19:53:24 +02:00
TomZ 0a916c21e9 Add UTXO support to APIs
Generically this looks like this;

IsUnspent
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 11 }
]
IsUnspentReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true },
  { "unspent": false }
]

GetUnspentOutput
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 0 }
]
GetUnspentOutputReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true,
    "amount": 1111, "outputscript": "bytearray" },
  { "unspent": false }
]

note: txids are naturally always sha256s.
2019-06-10 21:02:15 +02:00
TomZ 23d46d85f2 Add methods to request the serialized size of ints 2018-05-09 10:48:16 +02:00
TomZ d7b8e5ea5c Make adding uint256 to messageBuilder more generic
that way it will work for uint160 and others too
2018-02-18 15:11:17 +01:00
TomZ 1e66ae1434 More streaming additions 2018-02-17 14:47:51 +01:00
TomZ b76ca3a97e Start libs/utils 2018-02-13 13:27:58 +01:00