[#239] morph/client: Simplify code interacting with magic numbers
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
It can't be uint64 in fact, but this error is buried deeply in the NetworkInfo API structure, so we're not touching MagicNumber() for now. Signed-off-by: Roman Khimov <roman@nspcc.ru> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d686ab49e8
commit
d29b13454f
1 changed files with 4 additions and 9 deletions
|
@ -412,16 +412,11 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// error appears only if client
|
|
||||||
// is in inactive mode; that has
|
|
||||||
// been already checked above
|
|
||||||
magicNumber, _ := c.MagicNumber()
|
|
||||||
|
|
||||||
// mainTX is expected to be pre-validated: second witness must exist and be empty
|
// mainTX is expected to be pre-validated: second witness must exist and be empty
|
||||||
mainTx.Scripts[1].VerificationScript = multiaddrAccount.GetVerificationScript()
|
mainTx.Scripts[1].VerificationScript = multiaddrAccount.GetVerificationScript()
|
||||||
mainTx.Scripts[1].InvocationScript = append(
|
mainTx.Scripts[1].InvocationScript = append(
|
||||||
[]byte{byte(opcode.PUSHDATA1), 64},
|
[]byte{byte(opcode.PUSHDATA1), 64},
|
||||||
multiaddrAccount.PrivateKey().SignHashable(uint32(magicNumber), mainTx)...,
|
multiaddrAccount.SignHashable(c.rpcActor.GetNetwork(), mainTx)...,
|
||||||
)
|
)
|
||||||
|
|
||||||
//lint:ignore SA1019 https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/202
|
//lint:ignore SA1019 https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/202
|
||||||
|
@ -667,12 +662,12 @@ func (c *Client) notaryWitnesses(invokedByAlpha bool, multiaddr *wallet.Account,
|
||||||
// to pass Notary module verification
|
// to pass Notary module verification
|
||||||
var invokeScript []byte
|
var invokeScript []byte
|
||||||
|
|
||||||
magicNumber, _ := c.MagicNumber()
|
magicNumber := c.rpcActor.GetNetwork()
|
||||||
|
|
||||||
if invokedByAlpha {
|
if invokedByAlpha {
|
||||||
invokeScript = append(
|
invokeScript = append(
|
||||||
[]byte{byte(opcode.PUSHDATA1), 64},
|
[]byte{byte(opcode.PUSHDATA1), 64},
|
||||||
multiaddr.PrivateKey().SignHashable(uint32(magicNumber), tx)...,
|
multiaddr.SignHashable(magicNumber, tx)...,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// we can't provide alphabet node signature
|
// we can't provide alphabet node signature
|
||||||
|
@ -694,7 +689,7 @@ func (c *Client) notaryWitnesses(invokedByAlpha bool, multiaddr *wallet.Account,
|
||||||
// then we have invoker witness
|
// then we have invoker witness
|
||||||
invokeScript = append(
|
invokeScript = append(
|
||||||
[]byte{byte(opcode.PUSHDATA1), 64},
|
[]byte{byte(opcode.PUSHDATA1), 64},
|
||||||
c.acc.PrivateKey().SignHashable(uint32(magicNumber), tx)...,
|
c.acc.SignHashable(magicNumber, tx)...,
|
||||||
)
|
)
|
||||||
|
|
||||||
w = append(w, transaction.Witness{
|
w = append(w, transaction.Witness{
|
||||||
|
|
Loading…
Reference in a new issue