Skip to content

Commit 5482f72

Browse files
committed
github ci
1 parent d574ddd commit 5482f72

1 file changed

Lines changed: 109 additions & 31 deletions

File tree

.github/workflows/main.yml

Lines changed: 109 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ jobs:
161161
exit 1
162162
fi
163163

164-
165164
# Verify block-1.txt
166165
if [[ ! -s submission/block-1.txt ]]; then
167166
echo "❌ Error: block-1.txt is empty or missing."
@@ -176,39 +175,89 @@ jobs:
176175
exit 1
177176
fi
178177

179-
# Verify block-1.txt and coinbase-1.txt
180-
BLOCK=$(cat submission/block-1.txt)
181-
COINBASE=$(cat submission/coinbase-1.txt)
182-
if bitcoin-cli -signet getblock $BLOCK | grep -q "$COINBASE"; then
183-
echo "✅ Coinbase TX $COINBASE found in block $BLOCK"
178+
# Verify coinbase-1.txt
179+
if [[ ! -s submission/coinbase-1.txt ]]; then
180+
echo "❌ Error: coinbase-1.txt is empty or missing."
181+
exit 1
182+
fi
183+
COINBASE1=$(cat submission/coinbase-1.txt)
184+
EXP=$(bitcoin-cli -signet getblock $BLOCK1 | jq -r '.tx[0]')
185+
if echo "$EXP" | grep -xq "$COINBASE1"; then
186+
echo "✅ Coinbase-1 matches the first transaction in block-1"
184187
else
185-
echo "❌ Coinbase TX $COINBASE NOT found in block $BLOCK"
188+
echo "❌ Coinbase-1 does not match"
186189
exit 1
187190
fi
188191

189-
190192
# Verify transaction-2.txt (spend tx)
191-
TXID=$(cat submission/transaction-2.txt)
192-
if bitcoin-cli -signet -rpcwallet=$WALLET getrawtransaction $TXID &> /dev/null; then
193-
echo "✅ Spend transaction exists: $TXID"
193+
if [[ ! -s submission/transaction-2.txt ]]; then
194+
echo "❌ Error: transaction-2.txt is empty or missing."
195+
exit 1
196+
fi
197+
TX2=$(cat submission/transaction-2.txt)
198+
TX2_DETAILS=$(bitcoin-cli -signet getrawtransaction $TX2 true)
199+
AMOUNT_SENT=$(echo $TX2_DETAILS | jq -r ".vout[] | select(.scriptPubKey.address==\"tb1qddpcyus3u603n63lk7m5epjllgexc24vj5ltp7\") | .value")
200+
if [[ "$AMOUNT_SENT" == "0.00010000" ]]; then
201+
echo "✅ Sent exactly 10,000 sats."
194202
else
195-
echo "❌ Spend transaction not found: $TXID"
196-
exit 1
203+
echo "❌ Did not send exactly 10,000 sats."
204+
exit 1
205+
fi
206+
207+
# Verify fee
208+
TX2_META=$(bitcoin-cli -signet -rpcwallet=$WALLET gettransaction $TX2)
209+
FEE=$(echo $TX2_META | jq -r '.fee' | awk '{print int(-100000000 * $1)}')
210+
if [[ "$FEE" -eq 700 ]]; then
211+
echo "✅ Fee is exactly 700 sats."
212+
else
213+
echo "❌ Incorrect fee: $FEE sats."
214+
exit 1
215+
fi
216+
217+
# Verify Transaction fee can be upgraded
218+
HEX=$(echo $TX2_META | jq -r '.hex')
219+
SE=$(bitcoin-cli -signet decoderawtransaction $HEX | jq -r '.vin[0].sequence')
220+
if [[ -n "$SE" && "$SE" =~ ^[0-9]+$ && "$SE" -lt 4294967294 ]]; then
221+
echo "✅ Transaction is BIP125 replaceable."
222+
else
223+
echo "❌ Transaction is not BIP125 replaceable."
224+
exit 1
225+
fi
226+
227+
# Verify block-2.txt
228+
if [[ ! -s submission/block-2.txt ]]; then
229+
echo "❌ Error: block-2.txt is empty or missing."
230+
exit 1
231+
fi
232+
BLOCK2=$(cat submission/block-2.txt | tr -d '\n')
233+
TXS2=$(bitcoin-cli -signet getblock $BLOCK2 | jq -r '.tx[]')
234+
if echo "$TXS2" | grep -xq "$TX2"; then
235+
echo "✅ transaction-2 is included in block-2."
236+
else
237+
echo "❌ transaction-2 not found in block-2."
238+
exit 1
197239
fi
198-
199240

200-
# Verify block-2.txt and coinbase-2.txt
201-
BLOCK=$(cat submission/block-2.txt)
202-
COINBASE=$(cat submission/coinbase-2.txt)
203-
if bitcoin-cli -signet getblock $BLOCK | grep -q "$COINBASE"; then
204-
echo "✅ Coinbase TX $COINBASE found in block $BLOCK"
241+
# Verify coinbase-2.txt
242+
if [[ ! -s submission/coinbase-2.txt ]]; then
243+
echo "❌ Error: coinbase-2.txt is empty or missing."
244+
exit 1
245+
fi
246+
COINBASE2=$(cat submission/coinbase-2.txt)
247+
EXP2=$(bitcoin-cli -signet getblock $BLOCK2 | jq -r '.tx[0]')
248+
if echo "$EXP2" | grep -xq "$COINBASE2"; then
249+
echo "✅ Coinbase-2 matches the first transaction in block-2"
205250
else
206-
echo "❌ Coinbase TX $COINBASE NOT found in block $BLOCK"
251+
echo "❌ Coinbase-2 does not match"
207252
exit 1
208253
fi
209254

210255

211256
# Verify multisig address
257+
if [[ ! -s submission/multisig-address.txt ]]; then
258+
echo "❌ Error: multisig-address.txt is empty or missing."
259+
exit 1
260+
fi
212261
ADDRESS=$(cat submission/multisig-address.txt)
213262
if [[ $ADDRESS == "2"* ]]; then
214263
echo "✅ Multisig address look valid."
@@ -218,6 +267,10 @@ jobs:
218267
fi
219268

220269
# Verify multisig redeem script
270+
if [[ ! -s submission/multisig-redeem.txt ]]; then
271+
echo "❌ Error: multisig-redeem.txt is empty or missing."
272+
exit 1
273+
fi
221274
REDEEM=$(cat submission/multisig-redeem.txt)
222275
if [[ $REDEEM =~ ^[0-9a-fA-F]+$ ]]; then
223276
echo "✅ Multisig redeem script look valid."
@@ -226,19 +279,44 @@ jobs:
226279
exit 1
227280
fi
228281

229-
# Verify multisig transaction and block
230-
TXID=$(cat submission/multisig-transaction.txt)
231-
BLOCK=$(cat submission/multisig-block.txt)
232-
COINBASE=$(cat submission/multisig-coinbase.txt)
233-
if bitcoin-cli -signet getrawtransaction $TXID &> /dev/null; then
234-
echo "✅ Multisig funding transaction exists: $TXID"
282+
# Verify multisig transaction
283+
if [[ ! -s submission/multisig-transaction.txt ]]; then
284+
echo "❌ Error: multisig-transaction.txt is empty or missing."
285+
exit 1
286+
fi
287+
MU_TXID=$(cat submission/multisig-transaction.txt)
288+
R=$(bitcoin-cli -signet getrawtransaction "$MU_TXID" true | jq --arg addr "$ADDRESS" '.vout[] | select(.scriptPubKey.address == $addr)')
289+
if [[ -n "$R" ]]; then
290+
echo "✅ Multisig Funding transaction exists: $MU_TXID"
235291
else
236-
echo "❌ Multisig funding transaction not found"
237-
exit 1
292+
echo "❌ Multisig Funding transaction not found: $MU_TXID"
293+
exit 1
294+
fi
295+
296+
# Verify multisig-block.txt
297+
if [[ ! -s submission/multisig-block.txt ]]; then
298+
echo "❌ Error: bmultisig-block.txt is empty or missing."
299+
exit 1
300+
fi
301+
MU_BLOCK=$(cat submission/multisig-block.txt | tr -d '\n')
302+
MU_TXS=$(bitcoin-cli -signet getblock $MU_BLOCK | jq -r '.tx[]')
303+
if echo "$MU_TXS" | grep -xq "$MU_TXID"; then
304+
echo "✅ multisig transaction is included in multisig block."
305+
else
306+
echo "❌ multisig transaction not found in multisig block."
307+
exit 1
308+
fi
309+
310+
# Verify multisig-coinbase.txt
311+
if [[ ! -s submission/multisig-coinbase.txt ]]; then
312+
echo "❌ Error: multisig-coinbase.txt is empty or missing."
313+
exit 1
238314
fi
239-
if bitcoin-cli -signet getblock $BLOCK | grep -q "$COINBASE"; then
240-
echo "✅ Multisig coinbase TX $COINBASE found in block $BLOCK"
315+
MU_COINBASE=$(cat submission/multisig-coinbase.txt)
316+
FIRST=$(bitcoin-cli -signet getblock $MU_BLOCK | jq -r '.tx[0]')
317+
if echo "$FIRST" | grep -xq "$MU_COINBASE"; then
318+
echo "✅ multisig-coinbase matches the first transaction."
241319
else
242-
echo "❌ Multisig coinbase TX $COINBASE not found in block $BLOCK"
320+
echo "❌ multisig-coinbase does not match."
243321
exit 1
244322
fi

0 commit comments

Comments
 (0)