mirror of
https://github.com/Xahau/xahaud.git
synced 2026-07-28 17:40:10 +00:00
fix variable emit details size in example hooks
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* This hook just accepts any transaction coming through it
|
||||
*/
|
||||
#define HAS_CALLBACK
|
||||
#include "../hookapi.h"
|
||||
|
||||
int64_t cbak(uint32_t reserved) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
all:
|
||||
wasmcc accept.c -o accept.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasmcc accept.c -o /tmp/accept.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasm-opt -O2 /tmp/accept.wasm -o accept.wasm
|
||||
hook-cleaner accept.wasm
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#define HAS_CALLBACK
|
||||
#include <stdint.h>
|
||||
#include "hookapi.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
all:
|
||||
wasmcc carbon.c -o carbon.wasm -O2 -Wl,--allow-undefined -I../
|
||||
wasmcc carbon.c -o /tmp/carbon.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasm-opt -O2 /tmp/carbon.wasm -o carbon.wasm
|
||||
hook-cleaner carbon.wasm
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
all:
|
||||
wasmcc doubler.c -o doubler.wasm -O2 -Wl,--allow-undefined -I../
|
||||
wasmcc doubler.c -o /tmp/doubler.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasm-opt -O2 /tmp/doubler.wasm -o doubler.wasm
|
||||
hook-cleaner doubler.wasm
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ const secret = process.argv[2];
|
||||
const amount = BigInt(process.argv[3]) * 1000000n
|
||||
const dest = process.argv[4];
|
||||
|
||||
require('../utils-tests.js').TestRig('ws://localhost:6005').then(t=>
|
||||
require('../../utils-tests.js').TestRig('ws://localhost:6005').then(t=>
|
||||
{
|
||||
t.pay(secret, amount, dest).then(x=>
|
||||
{
|
||||
|
||||
@@ -481,7 +481,12 @@ int out_len = 0;\
|
||||
ENCODE_SIGNING_PUBKEY_NULL(buf_out );
|
||||
|
||||
|
||||
#define PREPARE_PAYMENT_SIMPLE_SIZE 270
|
||||
#ifdef HAS_CALLBACK
|
||||
#define PREPARE_PAYMENT_SIMPLE_SIZE 270U
|
||||
#else
|
||||
#define PREPARE_PAYMENT_SIMPLE_SIZE 248U
|
||||
#endif
|
||||
|
||||
#define PREPARE_PAYMENT_SIMPLE(buf_out_master, drops_amount_raw, to_address, dest_tag_raw, src_tag_raw)\
|
||||
{\
|
||||
uint8_t* buf_out = buf_out_master;\
|
||||
@@ -504,12 +509,16 @@ int out_len = 0;\
|
||||
_07_03_ENCODE_SIGNING_PUBKEY_NULL (buf_out ); /* pk | size 35 */ \
|
||||
_08_01_ENCODE_ACCOUNT_SRC (buf_out, acc ); /* account | size 22 */ \
|
||||
_08_03_ENCODE_ACCOUNT_DST (buf_out, to_address ); /* account | size 22 */ \
|
||||
etxn_details((uint32_t)buf_out, 138); /* emitdet | size 138 */ \
|
||||
int64_t fee = etxn_fee_base(buf_out_master, 270); \
|
||||
int64_t edlen = etxn_details((uint32_t)buf_out, PREPARE_PAYMENT_SIMPLE_SIZE); /* emitdet | size 1?? */ \
|
||||
int64_t fee = etxn_fee_base(buf_out_master, PREPARE_PAYMENT_SIMPLE_SIZE); \
|
||||
_06_08_ENCODE_DROPS_FEE (fee_ptr, fee ); \
|
||||
}
|
||||
|
||||
#ifdef HAS_CALLBACK
|
||||
#define PREPARE_PAYMENT_SIMPLE_TRUSTLINE_SIZE 309
|
||||
#else
|
||||
#define PREPARE_PAYMENT_SIMPLE_TRUSTLINE_SIZE 287
|
||||
#endif
|
||||
#define PREPARE_PAYMENT_SIMPLE_TRUSTLINE(buf_out_master, tlamt, drops_fee_raw, to_address, dest_tag_raw, src_tag_raw)\
|
||||
{\
|
||||
uint8_t* buf_out = buf_out_master;\
|
||||
@@ -532,8 +541,8 @@ int out_len = 0;\
|
||||
_07_03_ENCODE_SIGNING_PUBKEY_NULL (buf_out ); /* pk | size 35 */ \
|
||||
_08_01_ENCODE_ACCOUNT_SRC (buf_out, acc ); /* account | size 22 */ \
|
||||
_08_03_ENCODE_ACCOUNT_DST (buf_out, to_address ); /* account | size 22 */ \
|
||||
etxn_details((uint32_t)buf_out, 138); /* emitdet | size 138 */ \
|
||||
int64_t fee = etxn_fee_base(buf_out_master, 309); \
|
||||
etxn_details((uint32_t)buf_out, PREPARE_PAYMENT_SIMPLE_TRUSTLINE_SIZE); /* emitdet | size 1?? */ \
|
||||
int64_t fee = etxn_fee_base(buf_out_master, PREPARE_PAYMENT_SIMPLE_TRUSTLINE_SIZE); \
|
||||
_06_08_ENCODE_DROPS_FEE (fee_ptr, fee ); \
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
all:
|
||||
wasmcc notary.c -o notary.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasmcc notary.c -o /tmp/notary.wasm -O0 -Wl,--allow-undefined -I../
|
||||
wasm-opt -O2 /tmp/notary.wasm -o notary.wasm
|
||||
hook-cleaner notary.wasm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user