Enable local proof-of-work fallback #579
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
This enables the
pow-fallback
feature foriota-client
, which means publishing messages falls back to performing proof-of-work locally (on the client) when no nodes support remote proof-of-work.NOTE: this changes the behaviour of the
local_pow
setting on theClientBuilder
, making it a preference whether or not to try remote PoW first before using local PoW rather than a hard setting. Since thepow-fallback
is a compile-time feature we cannot change whether or not to fallback at runtime. This change may be temporary.Type of change
How the change has been tested
Tested with a local one-click-Tangle with remote PoW enabled and disabled on the Hornet node.
When remote PoW on the node is disabled and local PoW on the client is false without local fallback from this PR, we get the following error from the
Client
when trying to publish a new identity:Err > Error [ClientError]: Node error: Response error with status code 400: {"error":{"code":"400","message":"invalid parameter, error: proof of work is not enabled on this node: code=400, message=invalid parameter"}}
When remote PoW on the node is disabled with the local fallback enabled by this PR, the client performs PoW locally and successfully publishes the new identity (regardless of the
local_pow
variable).When remote PoW on the node is enabled the client respects the
local_pow
variable as per the current behaviour.Change checklist
Add an
x
to the boxes that are relevant to your changes.