Alpha: use the zero signature for anonymous operation

This commit is contained in:
Grégoire Henry 2018-06-06 13:17:36 +02:00
parent 6d2bf5af90
commit 9df99e4553
2 changed files with 9 additions and 2 deletions

View File

@ -15,6 +15,7 @@ let inject_seed_nonce_revelation rpc_config ?(chain = `Main) block ?async nonces
(fun (level, nonce) ->
Alpha_services.Forge.seed_nonce_revelation rpc_config
(chain, block) ~branch ~level ~nonce () >>=? fun bytes ->
let bytes = Signature.concat bytes Signature.zero in
Shell_services.Injection.operation rpc_config ?async ~chain bytes)
nonces >>=? fun ophs ->
return ophs

View File

@ -540,7 +540,13 @@ module Encoding = struct
]
let contents_list_encoding =
conv to_list of_list (list contents_encoding)
conv to_list of_list (Variable.list contents_encoding)
let optional_signature_encoding =
conv
(function Some s -> s | None -> Signature.zero)
(fun s -> if Signature.equal s Signature.zero then None else Some s)
Signature.encoding
let protocol_data_encoding =
def "operation.alpha.contents_and_signature" @@
@ -551,7 +557,7 @@ module Encoding = struct
Operation_data { contents ; signature })
(obj2
(req "contents" contents_list_encoding)
(varopt "signature" Signature.encoding))
(req "signature" optional_signature_encoding))
let operation_encoding =
conv