Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Added new helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Jan 29, 2020
1 parent 6fcaa31 commit 60bd7c1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/cgo/coin.block.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,29 @@ func SKY_coin_BlockHeader_PrevHash(_b C.BlockHeader__Handle, _arg0 *C.cipher__SH
}
return
}

//export SKY_coin_NewGenesisBlock
func SKY_coin_NewGenesisBlock(_genesisAddr *C.cipher__Address, _genesisCoins, _timestamp uint64, _arg2 *C.Block__Handle) (____error_code uint32) {
genesisAddr := *(*cipher.Address)(unsafe.Pointer(_genesisAddr))
genesisCoins := uint64(_genesisCoins)
timestamp := uint64(_timestamp)
__arg2, ____return_err := coin.NewGenesisBlock(genesisAddr, genesisCoins, timestamp)
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
__arg2.Head.Time = timestamp
*_arg2 = registerBlockHandle(__arg2)
}
return
}

//export SKY_coin_Block_HashBody
func SKY_coin_Block_HashBody(_b C.Block__Handle, _arg0 *C.cipher__SHA256) (____error_code uint32) {
b, ok := lookupBlockHandle(_b)
if !ok {
____error_code = SKY_BAD_HANDLE
return
}
__arg0 := b.Body.Hash()
*_arg0 = *(*C.cipher__SHA256)(unsafe.Pointer(&__arg0))
return
}

0 comments on commit 60bd7c1

Please sign in to comment.