diff options
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/common')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go b/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go index e46b3e9c9..0e847900f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/common/utils.go @@ -29,3 +29,13 @@ func GenerateRandomBytes() []byte { } return randomness } + +// CopyBytes copies byte slice. +func CopyBytes(src []byte) (dst []byte) { + if len(src) == 0 { + return + } + dst = make([]byte, len(src)) + copy(dst, src) + return +} |