From 08bed62ce786a35375c186bf7204a7ccacb949d5 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Mon, 15 Oct 2018 18:28:30 -0400 Subject: [PATCH] [test] refs #8 Added integrate callback --- LibskycoinNet/skycoin/skycoin.cs | 131 ++++++- LibskycoinNet/skycoin/skycoinPINVOKE.cs | 73 +++- LibskycoinNet/skycoin/skycoinnet_wrap.c | 470 ++++++++++++++++++----- LibskycoinNetTest/check_cipher_crypto.cs | 1 - LibskycoinNetTest/check_coin_block.cs | 44 ++- LibskycoinNetTest/transutils.cs | 5 +- gopath/src/github.com/skycoin/skycoin | 2 +- swig/include/libskycoin.h | 14 - 8 files changed, 582 insertions(+), 158 deletions(-) diff --git a/LibskycoinNet/skycoin/skycoin.cs b/LibskycoinNet/skycoin/skycoin.cs index d6723f10..b9b34210 100644 --- a/LibskycoinNet/skycoin/skycoin.cs +++ b/LibskycoinNet/skycoin/skycoin.cs @@ -62,6 +62,33 @@ public static GoSlice GoSlicep_value(GoSlice obj) { return ret; } + public static SWIGTYPE_p_GoUint8_ new_GoUint8Ptr() { + global::System.IntPtr cPtr = skycoinPINVOKE.new_GoUint8Ptr(); + SWIGTYPE_p_GoUint8_ ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_GoUint8_(cPtr, false); + return ret; + } + + public static SWIGTYPE_p_GoUint8_ copy_GoUint8Ptr(SWIGTYPE_p_GoUint8_ value) { + global::System.IntPtr cPtr = skycoinPINVOKE.copy_GoUint8Ptr(SWIGTYPE_p_GoUint8_.getCPtr(value)); + SWIGTYPE_p_GoUint8_ ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_GoUint8_(cPtr, false); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void delete_GoUint8Ptr(SWIGTYPE_p_GoUint8_ obj) { + skycoinPINVOKE.delete_GoUint8Ptr(SWIGTYPE_p_GoUint8_.getCPtr(obj)); + } + + public static void GoUint8Ptr_assign(SWIGTYPE_p_GoUint8_ obj, SWIGTYPE_p_GoUint8_ value) { + skycoinPINVOKE.GoUint8Ptr_assign(SWIGTYPE_p_GoUint8_.getCPtr(obj), SWIGTYPE_p_GoUint8_.getCPtr(value)); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + } + + public static SWIGTYPE_p_GoUint8_ GoUint8Ptr_value(SWIGTYPE_p_GoUint8_ obj) { + SWIGTYPE_p_GoUint8_ ret = new SWIGTYPE_p_GoUint8_(skycoinPINVOKE.GoUint8Ptr_value(SWIGTYPE_p_GoUint8_.getCPtr(obj)), true); + return ret; + } + public static _GoString_ new_GoStringp() { global::System.IntPtr cPtr = skycoinPINVOKE.new_GoStringp(); _GoString_ ret = (cPtr == global::System.IntPtr.Zero) ? null : new _GoString_(cPtr, false); @@ -351,6 +378,33 @@ public static SWIGTYPE_p_Block__Handle Block__HandlePtr_value(SWIGTYPE_p_Block__ return ret; } + public static SWIGTYPE_p_BlockBody__Handle new_BlockBody__HandlePtr() { + global::System.IntPtr cPtr = skycoinPINVOKE.new_BlockBody__HandlePtr(); + SWIGTYPE_p_BlockBody__Handle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_BlockBody__Handle(cPtr, false); + return ret; + } + + public static SWIGTYPE_p_BlockBody__Handle copy_BlockBody__HandlePtr(SWIGTYPE_p_BlockBody__Handle value) { + global::System.IntPtr cPtr = skycoinPINVOKE.copy_BlockBody__HandlePtr(SWIGTYPE_p_BlockBody__Handle.getCPtr(value)); + SWIGTYPE_p_BlockBody__Handle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_BlockBody__Handle(cPtr, false); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void delete_BlockBody__HandlePtr(SWIGTYPE_p_BlockBody__Handle obj) { + skycoinPINVOKE.delete_BlockBody__HandlePtr(SWIGTYPE_p_BlockBody__Handle.getCPtr(obj)); + } + + public static void BlockBody__HandlePtr_assign(SWIGTYPE_p_BlockBody__Handle obj, SWIGTYPE_p_BlockBody__Handle value) { + skycoinPINVOKE.BlockBody__HandlePtr_assign(SWIGTYPE_p_BlockBody__Handle.getCPtr(obj), SWIGTYPE_p_BlockBody__Handle.getCPtr(value)); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + } + + public static SWIGTYPE_p_BlockBody__Handle BlockBody__HandlePtr_value(SWIGTYPE_p_BlockBody__Handle obj) { + SWIGTYPE_p_BlockBody__Handle ret = new SWIGTYPE_p_BlockBody__Handle(skycoinPINVOKE.BlockBody__HandlePtr_value(SWIGTYPE_p_BlockBody__Handle.getCPtr(obj)), true); + return ret; + } + public static SWIGTYPE_p_Signature_Handle new_Signature_HandlePtr() { global::System.IntPtr cPtr = skycoinPINVOKE.new_Signature_HandlePtr(); SWIGTYPE_p_Signature_Handle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Signature_Handle(cPtr, false); @@ -484,6 +538,32 @@ public static SWIGTYPE_p_FeeCalcFunc FeeCalcFuncPtr_value(SWIGTYPE_p_FeeCalcFunc return ret; } + public static SWIGTYPE_p_p_coin__Block new_coin__BlockPtrPtr() { + global::System.IntPtr cPtr = skycoinPINVOKE.new_coin__BlockPtrPtr(); + SWIGTYPE_p_p_coin__Block ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_p_coin__Block(cPtr, false); + return ret; + } + + public static SWIGTYPE_p_p_coin__Block copy_coin__BlockPtrPtr(coin__Block value) { + global::System.IntPtr cPtr = skycoinPINVOKE.copy_coin__BlockPtrPtr(coin__Block.getCPtr(value)); + SWIGTYPE_p_p_coin__Block ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_p_coin__Block(cPtr, false); + return ret; + } + + public static void delete_coin__BlockPtrPtr(SWIGTYPE_p_p_coin__Block obj) { + skycoinPINVOKE.delete_coin__BlockPtrPtr(SWIGTYPE_p_p_coin__Block.getCPtr(obj)); + } + + public static void coin__BlockPtrPtr_assign(SWIGTYPE_p_p_coin__Block obj, coin__Block value) { + skycoinPINVOKE.coin__BlockPtrPtr_assign(SWIGTYPE_p_p_coin__Block.getCPtr(obj), coin__Block.getCPtr(value)); + } + + public static coin__Block coin__BlockPtrPtr_value(SWIGTYPE_p_p_coin__Block obj) { + global::System.IntPtr cPtr = skycoinPINVOKE.coin__BlockPtrPtr_value(SWIGTYPE_p_p_coin__Block.getCPtr(obj)); + coin__Block ret = (cPtr == global::System.IntPtr.Zero) ? null : new coin__Block(cPtr, false); + return ret; + } + public static void SKY_handle_close(SWIGTYPE_p_Handle p0) { skycoinPINVOKE.SKY_handle_close(SWIGTYPE_p_Handle.getCPtr(p0)); } @@ -494,6 +574,33 @@ public static uint zeroFeeCalculator(SWIGTYPE_p_Transaction__Handle handle, SWIG return ret; } + public static uint fix121FeeCalculator(SWIGTYPE_p_Transaction__Handle handle, SWIGTYPE_p_GoUint64_ pFee, SWIGTYPE_p_void context) { + uint ret = skycoinPINVOKE.fix121FeeCalculator(SWIGTYPE_p_Transaction__Handle.getCPtr(handle), SWIGTYPE_p_GoUint64_.getCPtr(pFee), SWIGTYPE_p_void.getCPtr(context)); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static uint badFeeCalculator(SWIGTYPE_p_Transaction__Handle handle, SWIGTYPE_p_GoUint64_ pFee, SWIGTYPE_p_void context) { + uint ret = skycoinPINVOKE.badFeeCalculator(SWIGTYPE_p_Transaction__Handle.getCPtr(handle), SWIGTYPE_p_GoUint64_.getCPtr(pFee), SWIGTYPE_p_void.getCPtr(context)); + if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static SWIGTYPE_p_FeeCalculator feeCalc() { + SWIGTYPE_p_FeeCalculator ret = new SWIGTYPE_p_FeeCalculator(skycoinPINVOKE.feeCalc(), true); + return ret; + } + + public static SWIGTYPE_p_FeeCalculator fix121() { + SWIGTYPE_p_FeeCalculator ret = new SWIGTYPE_p_FeeCalculator(skycoinPINVOKE.fix121(), true); + return ret; + } + + public static SWIGTYPE_p_FeeCalculator badCalc() { + SWIGTYPE_p_FeeCalculator ret = new SWIGTYPE_p_FeeCalculator(skycoinPINVOKE.badCalc(), true); + return ret; + } + public static int MEMPOOLIDX { set { skycoinPINVOKE.set_MEMPOOLIDX(value); @@ -1018,12 +1125,6 @@ public static uint SKY_fee_TransactionFee(SWIGTYPE_p_Transaction__Handle handle, return ret; } - public static uint SKY_coin_GetBlockObject(SWIGTYPE_p_Block__Handle handle, coin__Block outBlock) { - uint ret = skycoinPINVOKE.SKY_coin_GetBlockObject__SWIG_0(SWIGTYPE_p_Block__Handle.getCPtr(handle), coin__Block.getCPtr(outBlock)); - if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public static uint SKY_cipher_CheckSecKeyHash(cipher_SecKey s, cipher_SHA256 sha) { uint ret = skycoinPINVOKE.SKY_cipher_CheckSecKeyHash__SWIG_0(cipher_SecKey.getCPtr(s), cipher_SHA256.getCPtr(sha)); return ret; @@ -1183,7 +1284,7 @@ public static uint SKY_coin_CreateUnspent(coin__BlockHeader p0, SWIGTYPE_p_Trans } public static uint SKY_coin_GetBlockObject(SWIGTYPE_p_Block__Handle p0, SWIGTYPE_p_p_coin__Block p1) { - uint ret = skycoinPINVOKE.SKY_coin_GetBlockObject__SWIG_1(SWIGTYPE_p_Block__Handle.getCPtr(p0), SWIGTYPE_p_p_coin__Block.getCPtr(p1)); + uint ret = skycoinPINVOKE.SKY_coin_GetBlockObject(SWIGTYPE_p_Block__Handle.getCPtr(p0), SWIGTYPE_p_p_coin__Block.getCPtr(p1)); if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -2698,18 +2799,6 @@ public static uint SKY_secp256k1go_ECmultGen(secp256k1go__XYZ p0, SWIGTYPE_p_Num return ret; } - public static uint SKY_encrypt_Sha256Xor_Encrypt(GoSlice p0, GoSlice p1, GoSlice p2) { - uint ret = skycoinPINVOKE.SKY_encrypt_Sha256Xor_Encrypt(GoSlice.getCPtr(p0), GoSlice.getCPtr(p1), GoSlice.getCPtr (p2)); - if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static uint SKY_encrypt_Sha256Xor_Decrypt(GoSlice p0, GoSlice p1, GoSlice p2) { - uint ret = skycoinPINVOKE.SKY_encrypt_Sha256Xor_Decrypt(GoSlice.getCPtr(p0), GoSlice.getCPtr(p1), GoSlice.getCPtr (p2)); - if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public static uint SKY_droplet_FromString(string p0, SWIGTYPE_p_unsigned_long_long p1) { var tmpp0 = p0; { @@ -4087,8 +4176,8 @@ public static uint SKY_coin_Create_Transactions(SWIGTYPE_p_Transactions__Handle return ret; } - public static uint SKY_coin_GetTransactionsObject(SWIGTYPE_p_Transactions__Handle p0, SWIGTYPE_p_p_GoSlice_ p1) { - uint ret = skycoinPINVOKE.SKY_coin_GetTransactionsObject(SWIGTYPE_p_Transactions__Handle.getCPtr(p0), SWIGTYPE_p_p_GoSlice_.getCPtr(p1)); + public static uint SKY_coin_GetTransactionsObject(SWIGTYPE_p_Transactions__Handle p0, GoSlice p1) { + uint ret = skycoinPINVOKE.SKY_coin_GetTransactionsObject(SWIGTYPE_p_Transactions__Handle.getCPtr(p0), GoSlice.getCPtr (p1)); if (skycoinPINVOKE.SWIGPendingException.Pending) throw skycoinPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/LibskycoinNet/skycoin/skycoinPINVOKE.cs b/LibskycoinNet/skycoin/skycoinPINVOKE.cs index a2ca3a0b..c3f3010a 100644 --- a/LibskycoinNet/skycoin/skycoinPINVOKE.cs +++ b/LibskycoinNet/skycoin/skycoinPINVOKE.cs @@ -218,6 +218,21 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_GoSlicep_value")] public static extern global::System.IntPtr GoSlicep_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_new_GoUint8Ptr")] + public static extern global::System.IntPtr new_GoUint8Ptr(); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_copy_GoUint8Ptr")] + public static extern global::System.IntPtr copy_GoUint8Ptr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_delete_GoUint8Ptr")] + public static extern void delete_GoUint8Ptr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_GoUint8Ptr_assign")] + public static extern void GoUint8Ptr_assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_GoUint8Ptr_value")] + public static extern global::System.IntPtr GoUint8Ptr_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_new_GoStringp")] public static extern global::System.IntPtr new_GoStringp(); @@ -383,6 +398,21 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_Block__HandlePtr_value")] public static extern global::System.IntPtr Block__HandlePtr_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_new_BlockBody__HandlePtr")] + public static extern global::System.IntPtr new_BlockBody__HandlePtr(); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_copy_BlockBody__HandlePtr")] + public static extern global::System.IntPtr copy_BlockBody__HandlePtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_delete_BlockBody__HandlePtr")] + public static extern void delete_BlockBody__HandlePtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_BlockBody__HandlePtr_assign")] + public static extern void BlockBody__HandlePtr_assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_BlockBody__HandlePtr_value")] + public static extern global::System.IntPtr BlockBody__HandlePtr_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_new_Signature_HandlePtr")] public static extern global::System.IntPtr new_Signature_HandlePtr(); @@ -458,12 +488,42 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_FeeCalcFuncPtr_value")] public static extern global::System.IntPtr FeeCalcFuncPtr_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_new_coin__BlockPtrPtr")] + public static extern global::System.IntPtr new_coin__BlockPtrPtr(); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_copy_coin__BlockPtrPtr")] + public static extern global::System.IntPtr copy_coin__BlockPtrPtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_delete_coin__BlockPtrPtr")] + public static extern void delete_coin__BlockPtrPtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_coin__BlockPtrPtr_assign")] + public static extern void coin__BlockPtrPtr_assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_coin__BlockPtrPtr_value")] + public static extern global::System.IntPtr coin__BlockPtrPtr_value(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_handle_close")] public static extern void SKY_handle_close(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_zeroFeeCalculator")] public static extern uint zeroFeeCalculator(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_fix121FeeCalculator")] + public static extern uint fix121FeeCalculator(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_badFeeCalculator")] + public static extern uint badFeeCalculator(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_feeCalc")] + public static extern global::System.IntPtr feeCalc(); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_fix121")] + public static extern global::System.IntPtr fix121(); + + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_badCalc")] + public static extern global::System.IntPtr badCalc(); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_set_MEMPOOLIDX")] public static extern void set_MEMPOOLIDX(int jarg1); @@ -767,9 +827,6 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_fee_TransactionFee__SWIG_0")] public static extern uint SKY_fee_TransactionFee__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, ulong jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_coin_GetBlockObject__SWIG_0")] - public static extern uint SKY_coin_GetBlockObject__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_cipher_CheckSecKeyHash__SWIG_0")] public static extern uint SKY_cipher_CheckSecKeyHash__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -1232,8 +1289,8 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_coin_CreateUnspent")] public static extern uint SKY_coin_CreateUnspent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, long jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_coin_GetBlockObject__SWIG_1")] - public static extern uint SKY_coin_GetBlockObject__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_coin_GetBlockObject")] + public static extern uint SKY_coin_GetBlockObject(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_coin_GetBlockBody")] public static extern uint SKY_coin_GetBlockBody(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -1874,12 +1931,6 @@ static skycoinPINVOKE() { [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_secp256k1go_ECmultGen")] public static extern uint SKY_secp256k1go_ECmultGen(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_encrypt_Sha256Xor_Encrypt")] - public static extern uint SKY_encrypt_Sha256Xor_Encrypt(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_encrypt_Sha256Xor_Decrypt")] - public static extern uint SKY_encrypt_Sha256Xor_Decrypt(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); - [global::System.Runtime.InteropServices.DllImport("skycoin", EntryPoint="CSharp_skycoin_SKY_droplet_FromString")] public static extern uint SKY_droplet_FromString(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); diff --git a/LibskycoinNet/skycoin/skycoinnet_wrap.c b/LibskycoinNet/skycoin/skycoinnet_wrap.c index b1ccbfa5..6549de23 100644 --- a/LibskycoinNet/skycoin/skycoinnet_wrap.c +++ b/LibskycoinNet/skycoin/skycoinnet_wrap.c @@ -359,6 +359,29 @@ static GoSlice GoSlicep_value(GoSlice *obj) { } +static GoUint8_ *new_GoUint8Ptr() { + return (GoUint8_ *) calloc(1,sizeof(GoUint8_)); +} + +static GoUint8_ *copy_GoUint8Ptr(GoUint8_ value) { + GoUint8_ *obj = (GoUint8_ *) calloc(1,sizeof(GoUint8_)); + *obj = value; + return obj; +} + +static void delete_GoUint8Ptr(GoUint8_ *obj) { + if (obj) free(obj); +} + +static void GoUint8Ptr_assign(GoUint8_ *obj, GoUint8_ value) { + *obj = value; +} + +static GoUint8_ GoUint8Ptr_value(GoUint8_ *obj) { + return *obj; +} + + static _GoString_ *new_GoStringp() { return (_GoString_ *) calloc(1,sizeof(_GoString_)); } @@ -612,6 +635,29 @@ static Block__Handle Block__HandlePtr_value(Block__Handle *obj) { } +static BlockBody__Handle *new_BlockBody__HandlePtr() { + return (BlockBody__Handle *) calloc(1,sizeof(BlockBody__Handle)); +} + +static BlockBody__Handle *copy_BlockBody__HandlePtr(BlockBody__Handle value) { + BlockBody__Handle *obj = (BlockBody__Handle *) calloc(1,sizeof(BlockBody__Handle)); + *obj = value; + return obj; +} + +static void delete_BlockBody__HandlePtr(BlockBody__Handle *obj) { + if (obj) free(obj); +} + +static void BlockBody__HandlePtr_assign(BlockBody__Handle *obj, BlockBody__Handle value) { + *obj = value; +} + +static BlockBody__Handle BlockBody__HandlePtr_value(BlockBody__Handle *obj) { + return *obj; +} + + static Signature_Handle *new_Signature_HandlePtr() { return (Signature_Handle *) calloc(1,sizeof(Signature_Handle)); } @@ -727,6 +773,29 @@ static FeeCalcFunc FeeCalcFuncPtr_value(FeeCalcFunc *obj) { } +static coin__Block* *new_coin__BlockPtrPtr() { + return (coin__Block* *) calloc(1,sizeof(coin__Block*)); +} + +static coin__Block* *copy_coin__BlockPtrPtr(coin__Block* value) { + coin__Block* *obj = (coin__Block* *) calloc(1,sizeof(coin__Block*)); + *obj = value; + return obj; +} + +static void delete_coin__BlockPtrPtr(coin__Block* *obj) { + if (obj) free(obj); +} + +static void coin__BlockPtrPtr_assign(coin__Block* *obj, coin__Block* value) { + *obj = value; +} + +static coin__Block* coin__BlockPtrPtr_value(coin__Block* *obj) { + return *obj; +} + + #include "json.h" //Define function SKY_handle_close to avoid including libskycoin.h void SKY_handle_close(Handle p0); @@ -736,6 +805,30 @@ static FeeCalcFunc FeeCalcFuncPtr_value(FeeCalcFunc *obj) { return 0; } + GoUint32_ fix121FeeCalculator(Transaction__Handle handle, GoUint64_ *pFee, void* context){ + *pFee = 121; + return 0; +} + + GoUint32_ badFeeCalculator(Transaction__Handle handle, GoUint64_ *pFee, void* context){ + return 0x7FFFFFFF; +} + +FeeCalculator feeCalc(){ + FeeCalculator feeCalc = {zeroFeeCalculator, NULL}; + return feeCalc; +} + +FeeCalculator fix121(){ + FeeCalculator feeCalc = {fix121FeeCalculator, NULL}; + return feeCalc; +} + +FeeCalculator badCalc(){ + FeeCalculator feeCalc = {badFeeCalculator, NULL}; + return feeCalc; +} + int MEMPOOLIDX = 0; void *MEMPOOL[1024 * 256]; @@ -1852,12 +1945,6 @@ void makeEncryptedData(GoSlice data, GoUint32 dataLength, GoSlice pwd, coin__UxA }; - GoUint32 CSharp_skycoin_SKY_coin_GetBlockObject(Block__Handle handle, coin__Block* outBlock ){ - GoUint32 result = SKY_coin_GetBlockObject(handle, &outBlock); - return result; - }; - - GoUint32 CSharp_skycoin_SKY_cipher_CheckSecKeyHash(cipher_SecKey *s, cipher_SHA256* sha){ GoUint32 result = SKY_cipher_CheckSecKeyHash(s, sha); return result; @@ -1865,12 +1952,7 @@ void makeEncryptedData(GoSlice data, GoUint32 dataLength, GoSlice pwd, coin__UxA GoUint32 CSharp_skycoin_SKY_coin_NewBlock(Block__Handle p0, GoUint64 p1, cipher_SHA256* p2, Transactions__Handle p3, FeeCalculator* p4, Block__Handle* p5){ - FeeCalculator temp; - FeeCalculator *arg2 = (FeeCalculator *) 0 ; - temp.callback = zeroFeeCalculator; - temp.context = p4; - arg2 = &temp; - GoUint32 result = SKY_coin_NewBlock(p0, p1,p2,p3,arg2,p5); + GoUint32 result = SKY_coin_NewBlock(p0, p1,p2,p3,p4,p5); return result; } @@ -2299,6 +2381,74 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_GoSlicep_value(void * jarg1) { } +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_new_GoUint8Ptr() { + void * jresult ; + GoUint8_ *result = 0 ; + + result = (GoUint8_ *)new_GoUint8Ptr(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_copy_GoUint8Ptr(void * jarg1) { + void * jresult ; + GoUint8_ arg1 ; + GoUint8_ *argp1 ; + GoUint8_ *result = 0 ; + + argp1 = (GoUint8_ *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoUint8_", 0); + return 0; + } + arg1 = *argp1; + result = (GoUint8_ *)copy_GoUint8Ptr(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_delete_GoUint8Ptr(void * jarg1) { + GoUint8_ *arg1 = (GoUint8_ *) 0 ; + + arg1 = (GoUint8_ *)jarg1; + delete_GoUint8Ptr(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_GoUint8Ptr_assign(void * jarg1, void * jarg2) { + GoUint8_ *arg1 = (GoUint8_ *) 0 ; + GoUint8_ arg2 ; + GoUint8_ *argp2 ; + + arg1 = (GoUint8_ *)jarg1; + argp2 = (GoUint8_ *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoUint8_", 0); + return ; + } + arg2 = *argp2; + GoUint8Ptr_assign(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_GoUint8Ptr_value(void * jarg1) { + void * jresult ; + GoUint8_ *arg1 = (GoUint8_ *) 0 ; + GoUint8_ result; + + arg1 = (GoUint8_ *)jarg1; + result = GoUint8Ptr_value(arg1); + { + GoUint8_ * resultptr = (GoUint8_ *) malloc(sizeof(GoUint8_)); + memmove(resultptr, &result, sizeof(GoUint8_)); + jresult = resultptr; + } + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_new_GoStringp() { void * jresult ; _GoString_ *result = 0 ; @@ -2983,6 +3133,74 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_Block__HandlePtr_value(void * jarg1 } +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_new_BlockBody__HandlePtr() { + void * jresult ; + BlockBody__Handle *result = 0 ; + + result = (BlockBody__Handle *)new_BlockBody__HandlePtr(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_copy_BlockBody__HandlePtr(void * jarg1) { + void * jresult ; + BlockBody__Handle arg1 ; + BlockBody__Handle *argp1 ; + BlockBody__Handle *result = 0 ; + + argp1 = (BlockBody__Handle *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null BlockBody__Handle", 0); + return 0; + } + arg1 = *argp1; + result = (BlockBody__Handle *)copy_BlockBody__HandlePtr(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_delete_BlockBody__HandlePtr(void * jarg1) { + BlockBody__Handle *arg1 = (BlockBody__Handle *) 0 ; + + arg1 = (BlockBody__Handle *)jarg1; + delete_BlockBody__HandlePtr(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_BlockBody__HandlePtr_assign(void * jarg1, void * jarg2) { + BlockBody__Handle *arg1 = (BlockBody__Handle *) 0 ; + BlockBody__Handle arg2 ; + BlockBody__Handle *argp2 ; + + arg1 = (BlockBody__Handle *)jarg1; + argp2 = (BlockBody__Handle *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null BlockBody__Handle", 0); + return ; + } + arg2 = *argp2; + BlockBody__HandlePtr_assign(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_BlockBody__HandlePtr_value(void * jarg1) { + void * jresult ; + BlockBody__Handle *arg1 = (BlockBody__Handle *) 0 ; + BlockBody__Handle result; + + arg1 = (BlockBody__Handle *)jarg1; + result = BlockBody__HandlePtr_value(arg1); + { + BlockBody__Handle * resultptr = (BlockBody__Handle *) malloc(sizeof(BlockBody__Handle)); + memmove(resultptr, &result, sizeof(BlockBody__Handle)); + jresult = resultptr; + } + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_new_Signature_HandlePtr() { void * jresult ; Signature_Handle *result = 0 ; @@ -3307,6 +3525,58 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_FeeCalcFuncPtr_value(void * jarg1) } +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_new_coin__BlockPtrPtr() { + void * jresult ; + coin__Block **result = 0 ; + + result = (coin__Block **)new_coin__BlockPtrPtr(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_copy_coin__BlockPtrPtr(void * jarg1) { + void * jresult ; + coin__Block *arg1 = (coin__Block *) 0 ; + coin__Block **result = 0 ; + + arg1 = (coin__Block *)jarg1; + result = (coin__Block **)copy_coin__BlockPtrPtr(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_delete_coin__BlockPtrPtr(void * jarg1) { + coin__Block **arg1 = (coin__Block **) 0 ; + + arg1 = (coin__Block **)jarg1; + delete_coin__BlockPtrPtr(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_coin__BlockPtrPtr_assign(void * jarg1, void * jarg2) { + coin__Block **arg1 = (coin__Block **) 0 ; + coin__Block *arg2 = (coin__Block *) 0 ; + + arg1 = (coin__Block **)jarg1; + arg2 = (coin__Block *)jarg2; + coin__BlockPtrPtr_assign(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_coin__BlockPtrPtr_value(void * jarg1) { + void * jresult ; + coin__Block **arg1 = (coin__Block **) 0 ; + coin__Block *result = 0 ; + + arg1 = (coin__Block **)jarg1; + result = (coin__Block *)coin__BlockPtrPtr_value(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_SKY_handle_close(void * jarg1) { Handle arg1 ; @@ -3339,6 +3609,92 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_zeroFeeCalculator(void * jarg } +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_fix121FeeCalculator(void * jarg1, void * jarg2, void * jarg3) { + unsigned int jresult ; + Transaction__Handle arg1 ; + GoUint64_ *arg2 = (GoUint64_ *) 0 ; + void *arg3 = (void *) 0 ; + Transaction__Handle *argp1 ; + GoUint32_ result; + + argp1 = (Transaction__Handle *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Transaction__Handle", 0); + return 0; + } + arg1 = *argp1; + arg2 = (GoUint64_ *)jarg2; + arg3 = (void *)jarg3; + result = fix121FeeCalculator(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_badFeeCalculator(void * jarg1, void * jarg2, void * jarg3) { + unsigned int jresult ; + Transaction__Handle arg1 ; + GoUint64_ *arg2 = (GoUint64_ *) 0 ; + void *arg3 = (void *) 0 ; + Transaction__Handle *argp1 ; + GoUint32_ result; + + argp1 = (Transaction__Handle *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Transaction__Handle", 0); + return 0; + } + arg1 = *argp1; + arg2 = (GoUint64_ *)jarg2; + arg3 = (void *)jarg3; + result = badFeeCalculator(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_feeCalc() { + void * jresult ; + FeeCalculator result; + + result = feeCalc(); + { + FeeCalculator * resultptr = (FeeCalculator *) malloc(sizeof(FeeCalculator)); + memmove(resultptr, &result, sizeof(FeeCalculator)); + jresult = resultptr; + } + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_fix121() { + void * jresult ; + FeeCalculator result; + + result = fix121(); + { + FeeCalculator * resultptr = (FeeCalculator *) malloc(sizeof(FeeCalculator)); + memmove(resultptr, &result, sizeof(FeeCalculator)); + jresult = resultptr; + } + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_skycoin_badCalc() { + void * jresult ; + FeeCalculator result; + + result = badCalc(); + { + FeeCalculator * resultptr = (FeeCalculator *) malloc(sizeof(FeeCalculator)); + memmove(resultptr, &result, sizeof(FeeCalculator)); + jresult = resultptr; + } + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_set_MEMPOOLIDX(int jarg1) { int arg1 ; @@ -4843,26 +5199,6 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_fee_TransactionFee__SWIG_ } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_GetBlockObject__SWIG_0(void * jarg1, void * jarg2) { - unsigned int jresult ; - Block__Handle arg1 ; - coin__Block *arg2 = (coin__Block *) 0 ; - Block__Handle *argp1 ; - GoUint32 result; - - argp1 = (Block__Handle *)jarg1; - if (!argp1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Block__Handle", 0); - return 0; - } - arg1 = *argp1; - arg2 = (coin__Block *)jarg2; - result = (GoUint32)CSharp_skycoin_SKY_coin_GetBlockObject(arg1,arg2); - jresult = result; - return jresult; -} - - SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_cipher_CheckSecKeyHash__SWIG_0(void * jarg1, void * jarg2) { unsigned int jresult ; cipher_SecKey *arg1 = (cipher_SecKey *) 0 ; @@ -4877,7 +5213,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_cipher_CheckSecKeyHash__S } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewBlock__SWIG_0(void * jarg1, unsigned long long jarg2, void * jarg3, void * jarg4, FeeCalculator_ * jarg5, void * jarg6) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewBlock__SWIG_0(void * jarg1, unsigned long long jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6) { unsigned int jresult ; Block__Handle arg1 ; GoUint64 arg2 ; @@ -6440,7 +6776,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_skycoin_delete_GoSlice(void * jarg1) { } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewBlock__SWIG_1(void * jarg1, unsigned long long jarg2, cipher_SecKey* jarg3, void * jarg4, FeeCalculator_ * jarg5, void * jarg6) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewBlock__SWIG_1(void * jarg1, unsigned long long jarg2, cipher_SecKey* jarg3, void * jarg4, void * jarg5, void * jarg6) { unsigned int jresult ; Block__Handle arg1 ; GoUint64 arg2 ; @@ -6840,7 +7176,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_CreateUnspent(void * } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_GetBlockObject__SWIG_1(void * jarg1, void * jarg2) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_GetBlockObject(void * jarg1, void * jarg2) { unsigned int jresult ; Block__Handle arg1 ; coin__Block **arg2 = (coin__Block **) 0 ; @@ -11038,62 +11374,6 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_secp256k1go_ECmultGen(voi } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_encrypt_Sha256Xor_Encrypt(void * jarg1, void * jarg2, GoSlice_ * jarg3) { - unsigned int jresult ; - GoSlice arg1 ; - GoSlice arg2 ; - coin__UxArray *arg3 = (coin__UxArray *) 0 ; - GoSlice *argp1 ; - GoSlice *argp2 ; - GoUint32 result; - - argp1 = (GoSlice *)jarg1; - if (!argp1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoSlice", 0); - return 0; - } - arg1 = *argp1; - argp2 = (GoSlice *)jarg2; - if (!argp2) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoSlice", 0); - return 0; - } - arg2 = *argp2; - arg3 = (coin__UxArray *)jarg3; - result = (GoUint32)SKY_encrypt_Sha256Xor_Encrypt(arg1,arg2,arg3); - jresult = result; - return jresult; -} - - -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_encrypt_Sha256Xor_Decrypt(void * jarg1, void * jarg2, GoSlice_ * jarg3) { - unsigned int jresult ; - GoSlice arg1 ; - GoSlice arg2 ; - coin__UxArray *arg3 = (coin__UxArray *) 0 ; - GoSlice *argp1 ; - GoSlice *argp2 ; - GoUint32 result; - - argp1 = (GoSlice *)jarg1; - if (!argp1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoSlice", 0); - return 0; - } - arg1 = *argp1; - argp2 = (GoSlice *)jarg2; - if (!argp2) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null GoSlice", 0); - return 0; - } - arg2 = *argp2; - arg3 = (coin__UxArray *)jarg3; - result = (GoUint32)SKY_encrypt_Sha256Xor_Decrypt(arg1,arg2,arg3); - jresult = result; - return jresult; -} - - SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_droplet_FromString(char* jarg1, void * jarg2) { unsigned int jresult ; GoString arg1 ; @@ -14900,7 +15180,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_Create_Transactions( } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_GetTransactionsObject(void * jarg1, void * jarg2) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_GetTransactionsObject(void * jarg1, GoSlice_ * jarg2) { unsigned int jresult ; Transactions__Handle arg1 ; coin__UxArray **arg2 = (coin__UxArray **) 0 ; @@ -14966,7 +15246,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_Transactions_Add(voi } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_Transactions_Fees(void * jarg1, FeeCalculator_ * jarg2, void * jarg3) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_Transactions_Fees(void * jarg1, void * jarg2, void * jarg3) { unsigned int jresult ; Transactions__Handle arg1 ; FeeCalculator *arg2 = (FeeCalculator *) 0 ; @@ -15072,7 +15352,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_Transactions_Truncat } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_SortTransactions(void * jarg1, FeeCalculator_ * jarg2, void * jarg3) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_SortTransactions(void * jarg1, void * jarg2, void * jarg3) { unsigned int jresult ; Transactions__Handle arg1 ; FeeCalculator *arg2 = (FeeCalculator *) 0 ; @@ -15094,7 +15374,7 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_SortTransactions(voi } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewSortableTransactions(void * jarg1, FeeCalculator_ * jarg2, void * jarg3) { +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_skycoin_SKY_coin_NewSortableTransactions(void * jarg1, void * jarg2, void * jarg3) { unsigned int jresult ; Transactions__Handle arg1 ; FeeCalculator *arg2 = (FeeCalculator *) 0 ; diff --git a/LibskycoinNetTest/check_cipher_crypto.cs b/LibskycoinNetTest/check_cipher_crypto.cs index 26ef74c8..566be5c5 100644 --- a/LibskycoinNetTest/check_cipher_crypto.cs +++ b/LibskycoinNetTest/check_cipher_crypto.cs @@ -41,7 +41,6 @@ public void TestNewPubKey () { var pTemp = new GoSlice (); err = skycoin.skycoin.SKY_cipher_GenerateKeyPair (p, s); pTemp = p.toSlice (); - Console.WriteLine (pTemp.len); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); var p2 = new cipher_PubKey (); err = skycoin.skycoin.SKY_cipher_NewPubKey (pTemp, p2); diff --git a/LibskycoinNetTest/check_coin_block.cs b/LibskycoinNetTest/check_coin_block.cs index a483b037..4ca157fd 100644 --- a/LibskycoinNetTest/check_coin_block.cs +++ b/LibskycoinNetTest/check_coin_block.cs @@ -18,28 +18,43 @@ public SWIGTYPE_p_Transactions__Handle makeTestTransactions () { return txns; } - public uint zeroFeeCalculator (SWIGTYPE_p_Transaction__Handle tranas, SWIGTYPE_p_unsigned_long_long fee, SWIGTYPE_p_FeeCalcFunc context) { - skycoin.skycoin.GoUint64p_assign (fee, 0); - return 0; - - } - [Test] public void TestNewBlock () { - var txns = makeTestTransactions (); + var txns = transutils.makeTransactions (1); var block = skycoin.skycoin.new_Block__HandlePtr (); var err = skycoin.skycoin.SKY_coin_NewEmptyBlock (txns, block); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); - var pBlock = new coin__Block (); - err = skycoin.skycoin.SKY_coin_GetBlockObject (block, pBlock); + var pBlockP = skycoin.skycoin.new_coin__BlockPtrPtr (); + err = skycoin.skycoin.SKY_coin_GetBlockObject (block, pBlockP); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); + var pBlock = skycoin.skycoin.coin__BlockPtrPtr_value (pBlockP); pBlock.Head.Version = 0x02; pBlock.Head.Time = 100; pBlock.Head.BkSeq = 98; var uxHash = transutils.RandSHA256 (); - var zf = skycoin.skycoin.new_FeeCalculatorPtr (); - err = skycoin.skycoin.SKY_coin_NewBlock (block, 133, uxHash, txns, zf, block); + // invalid txn fees panics + err = skycoin.skycoin.SKY_coin_NewBlock (block, 133, uxHash, txns, transutils.badCalc, block); + Assert.AreEqual (err, skycoin.skycoin.SKY_ERROR); + // no txns panics + var tnxs1 = skycoin.skycoin.new_Transactions__Handlep (); + skycoin.skycoin.SKY_coin_Create_Transactions (tnxs1); + err = skycoin.skycoin.SKY_coin_NewBlock (block, 133, uxHash, tnxs1, transutils.feeCalc, block); + Assert.AreEqual (err, skycoin.skycoin.SKY_ERROR); + + // Valid block in fine + ulong fee = 121; + ulong currentTime = 133; + var b = skycoin.skycoin.new_Block__HandlePtr (); + err = skycoin.skycoin.SKY_coin_NewBlock (block, currentTime, uxHash, txns, transutils.fix121, b); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); + + var pBlock2P = skycoin.skycoin.new_coin__BlockPtrPtr (); + err = skycoin.skycoin.SKY_coin_GetBlockObject (b, pBlock2P); + var pBlock2 = skycoin.skycoin.coin__BlockPtrPtr_value (pBlock2P); + Assert.AreEqual (pBlock2.Head.Fee, fee); + var hashs = skycoin.skycoin.GoUint8Ptr_value (pBlock2.Head.PrevHash); + Console.WriteLine (hashs.ToString ()); + } [Test] @@ -62,8 +77,9 @@ public void TestNewGenesisBlock () { var block = skycoin.skycoin.new_Block__HandlePtr (); err = skycoin.skycoin.SKY_coin_NewGenesisBlock (addr, genCoins, genTime, block); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); - var pBlock = new coin__Block (); - err = skycoin.skycoin.SKY_coin_GetBlockObject (block, pBlock); + var pBlockPP = skycoin.skycoin.new_coin__BlockPtrPtr (); + err = skycoin.skycoin.SKY_coin_GetBlockObject (block, pBlockPP); + var pBlock = skycoin.skycoin.coin__BlockPtrPtr_value (pBlockPP); Assert.AreEqual (err, skycoin.skycoin.SKY_OK); var nullHash = new cipher_SHA256 (); var Head = new GoSlice (); @@ -73,7 +89,7 @@ public void TestNewGenesisBlock () { var strHead = new _GoString_ (); Head.getString (strHead); Assert.AreEqual (strnullHash.p, strHead.p); - // Assert.AreEqual (genTime, pBlock.Head.Time); + Assert.AreEqual (genTime, pBlock.Head.Time); Assert.AreEqual (0, pBlock.Head.BkSeq); Assert.AreEqual (0, pBlock.Head.Version); Assert.AreEqual (0, pBlock.Head.Fee); diff --git a/LibskycoinNetTest/transutils.cs b/LibskycoinNetTest/transutils.cs index 8fabe5d9..d7826e7b 100644 --- a/LibskycoinNetTest/transutils.cs +++ b/LibskycoinNetTest/transutils.cs @@ -4,7 +4,6 @@ using skycoin; namespace utils { public class transutils { - public delegate uint call (SWIGTYPE_p_Transaction__Handle tranas, SWIGTYPE_p_GoInt64_ fee, SWIGTYPE_p_FeeCalcFunc context); public cipher__Address makeAddress () { var pubkey = new cipher_PubKey (); var seckey = new cipher_SecKey (); @@ -163,6 +162,10 @@ public string base64Encode (string data) { } } + public SWIGTYPE_p_FeeCalculator feeCalc = skycoin.skycoin.feeCalc (); + public SWIGTYPE_p_FeeCalculator badCalc = skycoin.skycoin.badCalc (); + public SWIGTYPE_p_FeeCalculator fix121 = skycoin.skycoin.fix121 (); + public string base64Decode (string data) { try { System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding (); diff --git a/gopath/src/github.com/skycoin/skycoin b/gopath/src/github.com/skycoin/skycoin index 0aebb3d6..f56d6381 160000 --- a/gopath/src/github.com/skycoin/skycoin +++ b/gopath/src/github.com/skycoin/skycoin @@ -1 +1 @@ -Subproject commit 0aebb3d6f014ddcb96c34934ce61398df922c504 +Subproject commit f56d638133af6ad8e151cd67a75a2422e5037255 diff --git a/swig/include/libskycoin.h b/swig/include/libskycoin.h index d3bad5aa..304e90ad 100644 --- a/swig/include/libskycoin.h +++ b/swig/include/libskycoin.h @@ -268,16 +268,6 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_; #line 1 "cgo-generated-wrapper" -#line 10 "cipher.encrypt.sha256xor.go" - - - #include - #include - - #include "skytypes.h" - -#line 1 "cgo-generated-wrapper" - #line 5 "util.droplet.droplet.go" @@ -1064,10 +1054,6 @@ extern GoUint32 SKY_secp256k1go_XYZ_Add(secp256k1go__XYZ* p0, secp256k1go__XYZ* extern GoUint32 SKY_secp256k1go_ECmultGen(secp256k1go__XYZ* p0, Number_Handle p1); -extern GoUint32 SKY_encrypt_Sha256Xor_Encrypt(GoSlice p0, GoSlice p1, coin__UxArray* p2); - -extern GoUint32 SKY_encrypt_Sha256Xor_Decrypt(GoSlice p0, GoSlice p1, coin__UxArray* p2); - extern GoUint32 SKY_droplet_FromString(GoString p0, GoUint64* p1); extern GoUint32 SKY_droplet_ToString(GoUint64 p0, GoString_* p1);