Skip to content

Commit

Permalink
Allow fee to be below minfee, if given explicitly. (algorand#2295)
Browse files Browse the repository at this point in the history
This makes other txns accept explicitly low fees.  Sorry for the code
duplication, but I did not want to change libgoal's existing behavior
where it increases fee to minfee.
  • Loading branch information
jannotti authored Jun 16, 2021
1 parent 37b828a commit 0a3d9df
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cmd/goal/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ var createAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
// Broadcast
Expand Down Expand Up @@ -480,6 +484,10 @@ var updateAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down Expand Up @@ -553,6 +561,10 @@ var optInAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down Expand Up @@ -626,6 +638,10 @@ var closeOutAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down Expand Up @@ -699,6 +715,10 @@ var clearAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down Expand Up @@ -772,6 +792,10 @@ var callAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down Expand Up @@ -845,6 +869,10 @@ var deleteAppCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

// Broadcast or write transaction to file
if outFilename == "" {
Expand Down
21 changes: 21 additions & 0 deletions cmd/goal/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/spf13/cobra"

"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/libgoal"
)

Expand Down Expand Up @@ -214,6 +215,10 @@ var createAssetCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand Down Expand Up @@ -289,6 +294,10 @@ var destroyAssetCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand Down Expand Up @@ -378,6 +387,10 @@ var configAssetCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand Down Expand Up @@ -447,6 +460,10 @@ var sendAssetCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)
Expand Down Expand Up @@ -524,6 +541,10 @@ var freezeAssetCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand Down
4 changes: 4 additions & 0 deletions cmd/goal/interact.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@ var appExecuteCmd = &cobra.Command{
if err != nil {
reportErrorf("Cannot construct transaction: %s", err)
}
explicitFee := cmd.Flags().Changed("fee")
if explicitFee {
tx.Fee = basics.MicroAlgos{Raw: fee}
}

if outFilename == "" {
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand Down

0 comments on commit 0a3d9df

Please sign in to comment.