diff --git a/include/transaction.choose.go.h b/include/transaction.choose.go.h index 3024ea577..ebf8b3d7e 100644 --- a/include/transaction.choose.go.h +++ b/include/transaction.choose.go.h @@ -1,15 +1,10 @@ -/** - * Skycoin transaction. - * - * Instances of this struct are included in blocks. - */ -typedef struct { - cipher__SHA256 Hash; ///< Hash of underlying UxOut. - GoUint64_ BkSeq; ///< Block height corresponding to the - ///< moment balance calculation is performed at. - cipher__Address Address; ///< Account holder address. - GoUint64_ Coins; ///< Coins amount (e.g. in SKY). - GoUint64_ Hours; ///< Balance of Coin Hours generated by underlying UxOut, depending on UxOut's head time. +typedef struct{ + cipher__SHA256 Hash; + GoUint64_ BkSeq; + GoUint64_ Time; + cipher__Address Address; + GoUint64_ Coins; GoUint64_ InitialHours; + GoUint64_ Hours; cipher__SHA256 SrcTransaction; -} transaction__UxBalance; +} transaction__UxBalance; \ No newline at end of file diff --git a/lib/cgo/transaction.choose.go b/lib/cgo/transaction.choose.go index 45b8e6598..a679c98b2 100644 --- a/lib/cgo/transaction.choose.go +++ b/lib/cgo/transaction.choose.go @@ -5,7 +5,7 @@ import ( "unsafe" coin "github.com/SkycoinProject/skycoin/src/coin" - "github.com/SkycoinProject/skycoin/src/transaction" + transaction "github.com/SkycoinProject/skycoin/src/transaction" ) /* @@ -14,16 +14,15 @@ import ( #include #include "skytypes.h" - #include "skyfee.h" + #include "skyfee.h" */ import "C" -//export SKY_transaction_ChooseSpendsMaximizeUxOuts -func SKY_transaction_ChooseSpendsMaximizeUxOuts(_uxa []C.transaction__UxBalance, _coins, _hours uint64, _arg2 *C.GoSlice_) (____error_code uint32) { - txa := *(*[]transaction.UxBalance)(unsafe.Pointer(&_uxa)) - coins := _coins - hours := _hours - __arg2, ____return_err := transaction.ChooseSpendsMaximizeUxOuts(txa, coins, hours) +//export SKY_transaction_NewUxBalances +func SKY_transaction_NewUxBalances(_uxa *C.coin__UxArray, _headTime uint64, _arg2 *C.GoSlice_) (____error_code uint32) { + uxa := *(*coin.UxArray)(unsafe.Pointer(_uxa)) + headTime := _headTime + __arg2, ____return_err := transaction.NewUxBalances(uxa, headTime) ____error_code = libErrorCode(____return_err) if ____return_err == nil { copyToGoSlice(reflect.ValueOf(__arg2), _arg2) @@ -31,6 +30,18 @@ func SKY_transaction_ChooseSpendsMaximizeUxOuts(_uxa []C.transaction__UxBalance, return } +//export SKY_transaction_NewUxBalance +func SKY_transaction_NewUxBalance(_headTime uint64, _ux *C.coin__UxOut, _arg2 *C.transaction__UxBalance) (____error_code uint32) { + headTime := _headTime + ux := *(*coin.UxOut)(unsafe.Pointer(_ux)) + __arg2, ____return_err := transaction.NewUxBalance(headTime, ux) + ____error_code = libErrorCode(____return_err) + if ____return_err == nil { + *_arg2 = *(*C.transaction__UxBalance)(unsafe.Pointer(&__arg2)) + } + return +} + //export SKY_transaction_ChooseSpendsMinimizeUxOuts func SKY_transaction_ChooseSpendsMinimizeUxOuts(_uxa []C.transaction__UxBalance, _coins, _hours uint64, _arg2 *C.GoSlice_) (____error_code uint32) { uxa := *(*[]transaction.UxBalance)(unsafe.Pointer(&_uxa)) @@ -44,26 +55,29 @@ func SKY_transaction_ChooseSpendsMinimizeUxOuts(_uxa []C.transaction__UxBalance, return } -//export SKY_transaction_NewUxBalance -func SKY_transaction_NewUxBalance(_headTime uint64, _ux *C.coin__UxOut, _arg2 *C.transaction__UxBalance) (____error_code uint32) { - headTime := _headTime - ux := *(*coin.UxOut)(unsafe.Pointer(_ux)) - __arg2, ____return_err := transaction.NewUxBalance(headTime, ux) +//export SKY_transaction_ChooseSpendsMaximizeUxOuts +func SKY_transaction_ChooseSpendsMaximizeUxOuts(_uxa []C.transaction__UxBalance, _coins, _hours uint64, _arg2 *C.GoSlice_) (____error_code uint32) { + uxa := *(*[]transaction.UxBalance)(unsafe.Pointer(&_uxa)) + coins := _coins + hours := _hours + __arg2, ____return_err := transaction.ChooseSpendsMaximizeUxOuts(uxa, coins, hours) ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg2 = *(*C.transaction__UxBalance)(unsafe.Pointer(&__arg2)) + copyToGoSlice(reflect.ValueOf(__arg2), _arg2) } return } -//export SKY_transaction_NewUxBalances -func SKY_transaction_NewUxBalances(_headTime uint64, _uxa *C.coin__UxArray, _arg2 *C.GoSlice_) (____error_code uint32) { - headTime := _headTime - uxa := *(*coin.UxArray)(unsafe.Pointer(_uxa)) - __arg2, ____return_err := transaction.NewUxBalances(uxa, headTime) +//export SKY_transaction_ChooseSpends +func SKY_transaction_ChooseSpends(_uxa []C.transaction__UxBalance, _coins, _hours uint64, _sortStrategy, _arg3 *C.GoSlice_) (____error_code uint32) { + uxa := *(*[]transaction.UxBalance)(unsafe.Pointer(&_uxa)) + coins := _coins + hours := _hours + sortStrategy := copyToFunc(_sortStrategy) + __arg3, ____return_err := transaction.ChooseSpends(uxa, coins, hours, sortStrategy) ____error_code = libErrorCode(____return_err) if ____return_err == nil { - copyToGoSlice(reflect.ValueOf(__arg2), _arg2) + copyToGoSlice(reflect.ValueOf(__arg3), _arg3) } return }