mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 02:33:02 +02:00
add fanout. fix boltdb weirdness.
again with keys / values within the bolttx acting weird. it wasn't deleting utxos that had been spent by the ingested tx. it'd do the first 30 then stop. Deferred deletion and copied the serialized utxo. Not sure which of those fixed it. Maybe both.
This commit is contained in:
59
shell.go
59
shell.go
@@ -140,6 +140,13 @@ func Shellparse(cmdslice []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if cmd == "fan" {
|
||||
err = Fan(args)
|
||||
if err != nil {
|
||||
fmt.Printf("fan error: %s\n", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if cmd == "txs" {
|
||||
err = Txs(args)
|
||||
if err != nil {
|
||||
@@ -238,6 +245,14 @@ func Adr(args []string) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(args) > 1 {
|
||||
for i := 0; i < 1000; i++ {
|
||||
_, err := SCon.TS.NewAdr()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// always make one
|
||||
a, err := SCon.TS.NewAdr()
|
||||
@@ -250,6 +265,50 @@ func Adr(args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fan generates a bunch of fanout. Only for testing, can be expensive.
|
||||
// syntax: fan numOutputs valOutputs witty
|
||||
func Fan(args []string) error {
|
||||
if len(args) < 3 {
|
||||
return fmt.Errorf("fan syntax: fan numOutputs valOutputs witty")
|
||||
}
|
||||
numOutputs, err := strconv.ParseInt(args[0], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
valOutputs, err := strconv.ParseInt(args[1], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
wittynum, err := strconv.ParseInt(args[2], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
adrs := make([]btcutil.Address, numOutputs)
|
||||
amts := make([]int64, numOutputs)
|
||||
|
||||
oAdr, err := SCon.TS.NewAdr()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for i := int64(0); i < numOutputs; i++ {
|
||||
if wittynum != 0 {
|
||||
wAdr, err := btcutil.NewAddressWitnessPubKeyHash(
|
||||
oAdr.ScriptAddress(), SCon.TS.Param)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
adrs[i] = wAdr
|
||||
} else {
|
||||
adrs[i] = oAdr
|
||||
}
|
||||
amts[i] = valOutputs + i
|
||||
}
|
||||
|
||||
return SCon.SendCoins(adrs, amts)
|
||||
|
||||
}
|
||||
|
||||
// Send sends coins.
|
||||
func Send(args []string) error {
|
||||
if SCon.RBytes == 0 {
|
||||
|
Reference in New Issue
Block a user