@@ -1336,7 +1336,7 @@ impl<'a, 'b, 'hooks> Environment<'a, 'b, 'hooks> {
1336
1336
self . global_context . begin ( ) ;
1337
1337
let result = stx_transfer_consolidated ( self , from, to, amount, memo) ;
1338
1338
match result {
1339
- Ok ( value) => match value. clone ( ) . expect_result ( ) {
1339
+ Ok ( value) => match value. clone ( ) . expect_result ( ) ? {
1340
1340
Ok ( _) => {
1341
1341
self . global_context . commit ( ) ?;
1342
1342
Ok ( value)
@@ -1962,8 +1962,14 @@ impl CallStack {
1962
1962
1963
1963
#[ cfg( test) ]
1964
1964
mod test {
1965
+ use stacks_common:: types:: chainstate:: StacksAddress ;
1966
+ use stacks_common:: util:: hash:: Hash160 ;
1967
+
1965
1968
use super :: * ;
1966
1969
use crate :: vm:: callables:: DefineType ;
1970
+ use crate :: vm:: tests:: {
1971
+ test_epochs, tl_env_factory, MemoryEnvironmentGenerator , TopLevelMemoryEnvironmentGenerator ,
1972
+ } ;
1967
1973
use crate :: vm:: types:: signatures:: CallableSubtype ;
1968
1974
use crate :: vm:: types:: { FixedFunction , FunctionArg , FunctionType , StandardPrincipalData } ;
1969
1975
@@ -2119,6 +2125,35 @@ mod test {
2119
2125
assert_eq ! ( table[ & p2] [ & t7] , AssetMapEntry :: Burn ( 35 + 36 ) ) ;
2120
2126
}
2121
2127
2128
+ /// Test the stx-transfer consolidation tx invalidation
2129
+ /// bug from 2.4.0.1.0-rc1
2130
+ #[ apply( test_epochs) ]
2131
+ fn stx_transfer_consolidate_regr_24010 (
2132
+ epoch : StacksEpochId ,
2133
+ mut tl_env_factory : TopLevelMemoryEnvironmentGenerator ,
2134
+ ) {
2135
+ let mut env = tl_env_factory. get_env ( epoch) ;
2136
+ let u1 = StacksAddress {
2137
+ version : 0 ,
2138
+ bytes : Hash160 ( [ 1 ; 20 ] ) ,
2139
+ } ;
2140
+ let u2 = StacksAddress {
2141
+ version : 0 ,
2142
+ bytes : Hash160 ( [ 2 ; 20 ] ) ,
2143
+ } ;
2144
+ // insufficient balance must be a non-includable transaction. it must error here,
2145
+ // not simply rollback the tx and squelch the error as includable.
2146
+ let e = env
2147
+ . stx_transfer (
2148
+ & PrincipalData :: from ( u1. clone ( ) ) ,
2149
+ & PrincipalData :: from ( u2. clone ( ) ) ,
2150
+ 1000 ,
2151
+ & BuffData :: empty ( ) ,
2152
+ )
2153
+ . unwrap_err ( ) ;
2154
+ assert_eq ! ( e. to_string( ) , "Interpreter(InsufficientBalance)" ) ;
2155
+ }
2156
+
2122
2157
#[ test]
2123
2158
fn test_canonicalize_contract_context ( ) {
2124
2159
let trait_id = TraitIdentifier :: new (
0 commit comments