Closed levonpetrosyan93 closed 5 months ago
The recent changes encompass various enhancements to the RPC methods and the handling of transaction hashes within the blockchain. Key updates include new RPC commands for retrieving mempool transaction IDs and tags, modifications to the CBlockIndex
class to incorporate a ltagTxhash
map, and updates to the CSparkState
class to manage and retrieve transaction hashes. These improvements aim to extend functionality and provide more granularity in transaction data management.
File(s) | Change Summary |
---|---|
src/chain.h |
Added ltagTxhash map to CBlockIndex , cleared in constructor and destructor, serialized based on a flag. |
src/rpc/client.cpp |
Added new RPC method getmempooltxs . |
src/rpc/misc.cpp |
Introduced new functions for retrieving used coin tags, mempool transaction IDs, and spark data. |
src/rpc/server.cpp |
Added new RPC commands to retrieve transaction data. |
src/rpc/server.h |
Added declarations for new RPC functions. |
src/spark/state.cpp |
Enhanced CSparkState with methods for managing ltagTxhash and iterating over it conditionally. |
src/spark/state.h |
Added methods to CSparkState for inserting and retrieving elements in ltagTxhash . |
src/txdb.cpp |
Assigned ltagTxhash within LoadBlockIndexGuts . |
AddLTagTxHash
InteractionsequenceDiagram
participant CSparkState
participant CBlockIndex
participant CTransaction
CSparkState->>CBlockIndex: AddLTagTxHash(lTagHash, txHash)
CBlockIndex->>CSparkState: ltagTxhash[lTagHash] = txHash
CTransaction-->>CSparkState: Trigger ltagTxhash update on transaction spend
getmempooltxs
RPC MethodsequenceDiagram
participant Client
participant RPCServer
participant Mempool
Client->>RPCServer: getmempooltxs
RPCServer->>Mempool: Retrieve transactions
Mempool-->>RPCServer: Return transactions
RPCServer-->>Client: Respond with transaction data
Amidst the chains and coded lore,
A rabbit brings updates to explore.
With mempool data and hashes anew,
Our blockchain grows with every cue.
Tags and IDs set to flow,
In code's vast field, our knowledge grows.
Hopping through changes, here and there,
The blockchain's story we all share. 🌐🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@psolstice the description added.
Added new rpc calls,
getusedcoinstagstxhashes
, this rpc returns all spent coin serials attached to the hash of spending transaction, previously we hadgetusedcoinstags
, the new call allows to get also in which transaction is spent the coin, to do this we add field inside block index, and in spark state, when tx is being checked during block acceptance, we add the pair of ltag and tx hash into block index, and each time we construct the state, we get the data from the index. this fields are constructed in case-mobile
is passed,getmempooltxids
gives the list of spark tx hashes inside mempool, this allow to get spark state not only for blockchian but also from mempool.getmempooltxs
returns spark metadata for each tx hash, existing in mempool, in case there is no data for particular tx, that means tx is removed from mempool, confirmed or removed for another reason.