wtxmgr: extract label deserialization into separate function
Requrired so that we can use the same logic in dropwtxmgr.
This commit is contained in:
parent
4ec3fb4928
commit
ab19740c94
1 changed files with 6 additions and 0 deletions
|
@ -1025,6 +1025,12 @@ func FetchTxLabel(ns walletdb.ReadBucket, txid chainhash.Hash) (string, error) {
|
|||
return "", ErrTxLabelNotFound
|
||||
}
|
||||
|
||||
return DeserializeLabel(v)
|
||||
}
|
||||
|
||||
// DeserializeLabel reads a deserializes a length-value encoded label from the
|
||||
// byte array provided.
|
||||
func DeserializeLabel(v []byte) (string, error) {
|
||||
// If the label is empty, return an error.
|
||||
length := binary.BigEndian.Uint16(v[0:2])
|
||||
if length == 0 {
|
||||
|
|
Loading…
Reference in a new issue