Closed sideninja closed 3 months ago
This change introduces a new configuration option, IndexOnly
, that allows the gateway to operate in a mode where it only accepts state queries and disallows transaction submissions. This is implemented in the Config
struct and is reflected in the SendRawTransaction
method of the BlockChainAPI
struct, which now checks this configuration before processing transactions, enhancing robustness and control over transaction handling.
File | Change Summary |
---|---|
api/api.go | Added a guard clause in SendRawTransaction method to return an error if IndexOnly is true, preventing transaction processing in this mode. |
config/config.go | Introduced IndexOnly field in the Config struct and updated FromFlags function to include a --index-only command-line flag for configuration. |
sequenceDiagram
participant User
participant Gateway
participant BlockChainAPI
User->>Gateway: Send transaction
Gateway->>BlockChainAPI: Call SendRawTransaction
BlockChainAPI->>BlockChainAPI: Check IndexOnly
alt If IndexOnly is true
BlockChainAPI-->>Gateway: Return ErrNotSupported
Gateway-->>User: Notify transaction not supported
else
BlockChainAPI-->>Gateway: Process transaction
Gateway-->>User: Confirm transaction sent
end
In a meadow bright and fair,
A rabbit hops without a care.
With config changes, swift and neat,
Transactions pause, but queries greet!
"Hooray!" he sings, "for modes anew,
Let’s index first, then send, adieu!" 🐇✨
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?
Allow for gateway to be configured in index-only mode. This won't accept submitting transactions.
Summary by CodeRabbit
New Features
IndexOnly
allowing the gateway to operate in a mode that only accepts state queries, preventing transaction submissions.--index-only
for users to enable the index-only mode easily.Bug Fixes